diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 09cef8b8678d..ad9d2e1b8416 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -278,12 +278,25 @@ stdenv.mkDerivation { ## ## GCC libs for non-GCC support ## - + optionalString useGccForLibs '' + + optionalString useGccForLibs ('' + '' + # In theory we shouldn't need this, because we always set `useLLVM` on + # Darwin, and maybe also break down `useLLVM` into fine-grained use flags + # (libgcc vs compiler-rt, ld.lld vs legacy, libc++ vs libstdc++, etc.) + # since Darwin isn't `useLLVM` on all counts. (See + # https://clang.llvm.org/docs/Toolchain.html for all the axes one might + # break `useLLVM` into.) + # + # But, for now, we haven't doneo these things, so we use + # `targetPlatform.isLinux` as a proxy. + + optionalString targetPlatform.isLinux '' + echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags + '' + '' echo "-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-cflags echo "-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-ldflags echo "-L${gccForLibs.lib}/${targetPlatform.config}/lib" >> $out/nix-support/cc-ldflags - '' + '') ## ## General libc support diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix index 3d2cb3544b9f..d18d15420e97 100644 --- a/pkgs/development/compilers/llvm/10/default.nix +++ b/pkgs/development/compilers/llvm/10/default.nix @@ -26,8 +26,6 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix index e6765ec68990..8da51af68a25 100644 --- a/pkgs/development/compilers/llvm/11/default.nix +++ b/pkgs/development/compilers/llvm/11/default.nix @@ -26,8 +26,6 @@ let ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix index 36495249d16f..c06522c7e822 100644 --- a/pkgs/development/compilers/llvm/5/default.nix +++ b/pkgs/development/compilers/llvm/5/default.nix @@ -25,8 +25,6 @@ let ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc" ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/development/compilers/llvm/6/default.nix b/pkgs/development/compilers/llvm/6/default.nix index 4c2e87ec5e1a..d9a57258e5a0 100644 --- a/pkgs/development/compilers/llvm/6/default.nix +++ b/pkgs/development/compilers/llvm/6/default.nix @@ -25,8 +25,6 @@ let ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc" ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index 3dd067ae607e..317e344f72e2 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -25,8 +25,6 @@ let ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc" ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix index 6e80737f32ad..7f87ea9fc05d 100644 --- a/pkgs/development/compilers/llvm/8/default.nix +++ b/pkgs/development/compilers/llvm/8/default.nix @@ -25,8 +25,6 @@ let ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc" ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix index 6f5bdb8e8cc1..b3afbca68bac 100644 --- a/pkgs/development/compilers/llvm/9/default.nix +++ b/pkgs/development/compilers/llvm/9/default.nix @@ -25,8 +25,6 @@ let ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc" ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; in { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dcadb0ab14b6..70a9914c3f7d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8956,8 +8956,6 @@ in mkdir -p "$rsrc/lib" ln -s "${cc}/lib" "$rsrc/include" echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags - '' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) '' - echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags ''; };