Unverified Commit 3436075b authored by Rahul Butani's avatar Rahul Butani
Browse files

llvmPackages_15.llvm: specify some deps explicitly to fix cross-compilation

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
parent 5e5ed7d8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
, darwin
, ninja
, python3
, python3Packages
, libffi
, libbfd
, libpfm
@@ -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 {
@@ -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