glibc: always compile with a gcc stdenv#119786
Conversation
Our glibc doesn't compile with clang and useLLVM doesn't make the stdenv implicitly switch to musl (and arguably shouldn't do that). To make LLVM cross compilation without patching glibc to compile with clang (which is probably a lot of work), always compile glibc with gcc. This should unbreak a lot of cross compilation tests, I have tested: * tests.cross.llvm.gnu64 * tests.cross.llvm.aarch64-multiplatform Basing against staging because this change only really makes sense if useLLVM works with llvmPackages_7 which is only the case in staging at the moment.
|
|
||
| crossLibcStdenv = | ||
| if stdenv.hostPlatform.useLLVM or false | ||
| then overrideCC stdenv buildPackages.llvmPackages_8.lldClangNoLibc |
There was a problem hiding this comment.
BTW this should use the default LLVM version now that it's updated to be newer for cross.
There was a problem hiding this comment.
It's still clang 7 for useLLVM right? I think we'll have to check up on this topic anyways. Unfortunately there's still some issue with llvmPackages_7.lldClang with C++ and libunwind (i. e. ncurses' C++ library doesn't compile with useLLVM atm).
This is probably something unrelated to this though, I'd expect we can compile musl with clang 7 just fine. I'll try to rememeber to check that later.
There was a problem hiding this comment.
I think it's a later version when cross compilation is involved. We can tweak the condition if something isn't working.
There was a problem hiding this comment.
At least stdenv itself still uses clang 7.
Provide a version of nixpkgs which is built using the LLVM toolchain. This is achieved by reusing the useLLVM attribute usable in the cross toolchain bootstrapping which is a) perfectly acceptable and b) the only way to bootstrap a LLVM stdenv across platforms without unreasonable amounts of work. This is mostly working now since we fixed some issues with llvmPackages_7.lldClang in NixOS#119717 and compile glibc with gcc at all times as of NixOS#119786 (since clang can't compile our glibc at the moment). There are seemingly some issues left to be ironed out, for example the C++ library of ncurses fails to build with a linking issue. I have attempted to alleviate that problem with NixOS#120790, but to no avail so far. Nonetheless, having a working pkgsLLVM.hello is a good start. A currently present issue is that there is no way to change the libc since there is some issue with lldClang actually picking up on the set libc. This will need investigation and fixing.
Our glibc doesn't compile with clang and useLLVM doesn't make the stdenv
implicitly switch to musl (and arguably shouldn't do that). To make LLVM
cross compilation without patching glibc to compile with clang (which is
probably a lot of work), always compile glibc with gcc. This should
unbreak a lot of cross compilation tests, I have tested:
Basing against staging because this change only really makes sense if
useLLVM works with llvmPackages_7 which is only the case in staging at
the moment.
Motivation for this change
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)