Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross compilation of clang (or llvmPackages*.tools) fails to evaluate #49475

Closed
dtzWill opened this issue Oct 30, 2018 · 8 comments
Closed

cross compilation of clang (or llvmPackages*.tools) fails to evaluate #49475

dtzWill opened this issue Oct 30, 2018 · 8 comments
Assignees
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Milestone

Comments

@dtzWill
Copy link
Member

dtzWill commented Oct 30, 2018

Issue description

Evaluation complains that llvmPackages attribute doesn't exist in targetPackages.

Indeed, investigating with nix repl suggests targetPackages only contains stdenv.

Steps to reproduce

  • $ nix build -f channel:nixos-unstable pkgsCross.musl64.clang

OR

$ nix build -f channel:nixos-unstable pkgsCross.aarch64-multiplatform.clang

and so on.

FWIW occurs when directly setting crossSystem instead of using convenience pkgsCross.

@dtzWill dtzWill changed the title cross compilation of clang (or anything from llvmPackages{,_N}.*) fails to evaluate cross compilation of clang (or anything from llvmPackages{,_N}) fails to evaluate Oct 30, 2018
@dtzWill
Copy link
Member Author

dtzWill commented Oct 30, 2018

This somehow made it to 18.09 as well? :(

To see it non-broken, you'll have to use 18.03 which is before the nice pkgsCross bits, so something like:

$ nix build -f channel:nixos-18.03 --arg crossSystem '{config="x86_64-unknown-linux-musl";}' clang

@dtzWill
Copy link
Member Author

dtzWill commented Oct 30, 2018

Not sure what caused it, but I bet @Ericson2314 knows how to fix it 😇

@dtzWill
Copy link
Member Author

dtzWill commented Oct 30, 2018

  • Goes back before 18.09 branch
  • clangStdenv and llvm work -- as does llvmPackages{,_N}.{llvm,stdenv,libcxx}
  • llvmPackages*.tools does not

Hmm this may be known and possibly mentioned but I forgot...? If nothing else it'd be good to improve this error so it's clearer to new folk or those who forget things ;).


git bisect says 6e7e22d is "first bad commit", FWIW.

@dtzWill dtzWill changed the title cross compilation of clang (or anything from llvmPackages{,_N}) fails to evaluate cross compilation of clang (or llvmPackages*.tools) fails to evaluate Oct 30, 2018
@Ericson2314
Copy link
Member

Ericson2314 commented Oct 30, 2018

This is because pkgs.targetPackages != pkgs in cross builds. This because at then end of /pkgs/stdenv/booter.nix it makes a fake stadenv so things like targetPackages.stdenv.cc go to a good choice of C compiler to use at run time (a choice that would technically be made by the next change).

In this case, well, there is no next stage so hard to tell what runtime libraries to use! It's unfortunate. Not sure what the best fix is.

nix build -f channel:nixos-unstable pkgsCross.musl64.llvmPackages.clang-unwrapped

is fine since it has no runtime libs and indeed evals fine.

@Ericson2314
Copy link
Member

Ericson2314 commented Oct 30, 2018

So yes, the real solution is issue #49481 / #26004 haha

@dtzWill
Copy link
Member Author

dtzWill commented Oct 31, 2018 via email

@Ericson2314
Copy link
Member

@dtzWill Yeah maybe we should change it so targetPackages = pkgs // { stdenv = fake }; in pkgs/stdenv/booter.nix instead.

@c0bw3b c0bw3b added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Nov 21, 2018
@matthewbauer matthewbauer added this to the 19.03 milestone Jan 27, 2019
@matthewbauer
Copy link
Member

This looks to be fixed?

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

No branches or pull requests

5 participants