Skip to content

Commit

Permalink
llvmPackages_15.llvm: specify some deps explicitly to fix cross-compi…
Browse files Browse the repository at this point in the history
…lation

The two scenarios described within where splicing doesn't handle
selecting the right package for us are observable in the following
(nix repl session):
```
> np = import <nixpkgs> { system = "x86_64-linux"; crossSystem = { config = "aarch64-linux"; }; }

> np.__splicedPackages.hello ? __spliced
true

> np.__splicedPackages.python3Packages.psutil ? __spliced
true

> np.__splicedPackages.python3.pkgs.psutil ? __spliced
false

> (np.__splicedPackages.python3.withPackages (ps: with ps; [psutil])) ? __spliced
false
```

See: #211340
  • Loading branch information
rrbutani authored and K900 committed Jan 28, 2023
1 parent 36407b9 commit 43302e0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkgs/development/compilers/llvm/15/llvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, darwin
, ninja
, python3
, python3Packages
, libffi
, libbfd
, libpfm
Expand Down Expand Up @@ -55,9 +56,12 @@ let
# So, we "manually" assemble one python derivation for the package to depend
# on, taking into account whether checks are enabled or not:
python = if doCheck then
# Note that we _explicitly_ ask for a python interpreter for our host
# platform here; the splicing that would ordinarily take care of this for
# us does not seem to work once we use `withPackages`.
let
checkDeps = ps: with ps; [ psutil ];
in python3.withPackages checkDeps
in pkgsBuildBuild.targetPackages.python3.withPackages checkDeps
else python3;

in stdenv.mkDerivation (rec {
Expand All @@ -79,7 +83,11 @@ in stdenv.mkDerivation (rec {
outputs = [ "out" "lib" "dev" "python" ];

nativeBuildInputs = [ cmake ninja python ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
++ optionals enableManpages [
# Note: we intentionally use `python3Packages` instead of `python3.pkgs`;
# splicing does *not* work with the latter. (TODO: fix)
python3Packages.sphinx python3Packages.recommonmark
];

buildInputs = [ libxml2 libffi ]
++ optional enablePFM libpfm; # exegesis
Expand Down

0 comments on commit 43302e0

Please sign in to comment.