Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ let
binutils_bin = if nativeTools then "" else getBin binutils;
# The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
coreutils_bin = if nativeTools then "" else getBin coreutils;

default_cxx_stdlib_compile=optionalString (stdenv.isLinux && !(cc.isGNU or false))
"-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)";
in

stdenv.mkDerivation {
Expand All @@ -46,8 +49,9 @@ stdenv.mkDerivation {
inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin;
gnugrep_bin = if nativeTools then "" else gnugrep;


passthru = {
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang;
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile;

emacsBufferSetup = pkgs: ''
; We should handle propagation here too
Expand Down Expand Up @@ -189,11 +193,7 @@ stdenv.mkDerivation {

export real_cc=cc
export real_cxx=c++
export default_cxx_stdlib_compile="${
if stdenv.isLinux && !(cc.isGNU or false)
then "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)"
else ""
}"
export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}"

if [ -e $ccPath/gcc ]; then
wrap gcc ${./cc-wrapper.sh} $ccPath/gcc
Expand Down
7 changes: 7 additions & 0 deletions pkgs/misc/vim-plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ rec {
sha256 = "19zs03giv8h5xmv18y9zn85sxr8akphvbscclrqhs4cf88285cgl";
};
dependencies = [];
# In addition to the arguments you pass to your compiler, you also need to
# specify the path of the C++ std header (if you are using C++).
# These usually implicitly set by cc-wrapper around clang (pkgs/build-support/cc-wrapper).
# The linked ruby code shows generates the required '.clang_complete' for cmake based projects
# https://gist.github.com/Mic92/135e83803ed29162817fce4098dec144
# as an alternative you can execute the following command:
# $ eval echo $(nix-instantiate --eval --expr 'with (import <nixpkgs>) {}; clang.default_cxx_stdlib_compile')
preFixup = ''
substituteInPlace "$out"/share/vim-plugins/clang_complete/plugin/clang_complete.vim \
--replace "let g:clang_library_path = '' + "''" + ''" "let g:clang_library_path='${llvmPackages.clang.cc}/lib/libclang.so'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# In addition to the arguments you pass to your compiler, you also need to
# specify the path of the C++ std header (if you are using C++).
# These usually implicitly set by cc-wrapper around clang (pkgs/build-support/cc-wrapper).
# The linked ruby code shows generates the required '.clang_complete' for cmake based projects
# https://gist.github.com/Mic92/135e83803ed29162817fce4098dec144
# as an alternative you can execute the following command:
# $ eval echo $(nix-instantiate --eval --expr 'with (import <nixpkgs>) {}; clang.default_cxx_stdlib_compile')
preFixup = ''
substituteInPlace "$out"/share/vim-plugins/clang_complete/plugin/clang_complete.vim \
--replace "let g:clang_library_path = '' + "''" + ''" "let g:clang_library_path='${llvmPackages.clang.cc}/lib/libclang.so'"
Expand Down