stdenv.adapters: fixx overrideLibcxx to refer to existing compiler-rt

Before the change `pkgsLLVM` attributes were failing to pull in
`compiler-rt` on `x86_64-linux`:

    $ nix build --no-link -f. pkgsLLVM.asciidoc-full
    error:
       error: attribute 'llvmPackages_13' missing

       at pkgs/stdenv/adapters.nix:86:32:

           85|       inherit libcxx;
           86|       extraPackages = [ cxxabi pkgs.pkgsTargetTarget."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt ];
             |                                ^
           87|     });

It happens because `pkgs.pkgsTargetTarget` are always empty for
cross-packages like `pkgsLLVM.`, `pkgsCross.*.` or
`--arg crossSystem '...'`.
This commit is contained in:
Sergei Trofimovich 2024-01-07 22:11:49 +00:00
parent 88f163d662
commit 55249c817f

View file

@ -83,7 +83,10 @@ rec {
in
overrideCC stdenv (stdenv.cc.override {
inherit libcxx;
extraPackages = [ cxxabi pkgs.pkgsTargetTarget."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt ];
extraPackages = [
cxxabi
pkgs.buildPackages.targetPackages."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt
];
});
# Override the setup script of stdenv. Useful for testing new