summary refs log tree commit diff
path: root/pkgs/stdenv/cross
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-01-07 02:30:01 +0100
committersternenseemann <sternenseemann@systemli.org>2022-01-07 14:42:41 +0100
commit766f5ffb761bc916ea0f270f472d04ab30664d52 (patch)
treed67895941f0a0760acdae057ce0b51450b84268d /pkgs/stdenv/cross
parent17c5a15c89f2523b2543f946daa4d018e04d731a (diff)
downloadnixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.tar
nixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.tar.gz
nixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.tar.bz2
nixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.tar.lz
nixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.tar.xz
nixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.tar.zst
nixpkgs-766f5ffb761bc916ea0f270f472d04ab30664d52.zip
llvmPackages_*: respect cc for target when choosing C++ flavour
llvmPackages_*.clang should check the default compiler for the package
set it is targeting (targetPackages.stdenv.cc) instead of the compiler
that has been used to build it (stdenv.cc) in order to get some sense of
whether to use libc++ or libstdc++.

Since we are now inspecting targetPackages in the llvmPackages.clang
attribute, we need to avoid using it in the cross stdenv — which just
forces us to explicitly request libcxxClang for darwin instead of
relying on the clang attribute to pick it for us.

We also need to do something similar for targetPackages.stdenv.cc: Here
the llvmPackages.clang logic would work as we want (inspect
targetPackages.stdenv.cc and if it doesn't exist, make the choice based
on stdenv.cc), but it gets locked in a cycle with the previous package.
We can easily break this, however: We know that the previous set had
clang and the next one doesn't exist, so we'd choose libcxxClang any day
of the week.
Diffstat (limited to 'pkgs/stdenv/cross')
-rw-r--r--pkgs/stdenv/cross/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix
index 613b8d5304c..e01ac74599a 100644
--- a/pkgs/stdenv/cross/default.nix
+++ b/pkgs/stdenv/cross/default.nix
@@ -70,7 +70,7 @@ in lib.init bootStages ++ [
              # when there is a C compiler and everything should be fine.
              then throw "no C compiler provided for this platform"
            else if crossSystem.isDarwin
-             then buildPackages.llvmPackages.clang
+             then buildPackages.llvmPackages.libcxxClang
            else if crossSystem.useLLVM or false
              then buildPackages.llvmPackages.clangUseLLVM
            else buildPackages.gcc;