stdenv/darwin: assemble full clang toolchain#94427
stdenv/darwin: assemble full clang toolchain#94427thefloweringash wants to merge 2 commits intoNixOS:stagingfrom
Conversation
0aa369e to
00cfe87
Compare
00cfe87 to
61c7485
Compare
|
The current state of this now is able to build The only remaining mystery is if |
Adapted from main expression for clang 7.
61c7485 to
25c16f3
Compare
Build the llvm support libraries (libcxx, libcxxabi) from scratch
without using the existing llvm libraries. This is the same spirit and
similar implementation as the "useLLVM" bootstrap in llvm package
sets. Critically it avoids having libcxxabi provided by the cc-wrapper
when building libcxx, which otherwise results in two libcxxabi
instances.
$ otool -L /nix/store/vd4vvgs9xngqbjzpg3qc41wl6jh42s9i-libc++-7.1.0/lib/libc++.dylib
/nix/store/vd4vvgs9xngqbjzpg3qc41wl6jh42s9i-libc++-7.1.0/lib/libc++.dylib:
/nix/store/vd4vvgs9xngqbjzpg3qc41wl6jh42s9i-libc++-7.1.0/lib/libc++.1.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/nix/store/gmpwk5fyp3iasppqrrdpswxvid6kcp8r-libc++abi-7.1.0/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1.0.0)
/nix/store/3hn7azynqgp2pm5gpdg45gpq0ia72skg-libc++abi-7.1.0/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1.0.0)
/nix/store/1nq94scbxs6bk7pimqhvz76q6cfmbv97-Libsystem-osx-10.12.6/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
Additionally move some utilities (clang, binutils, coreutils, gnugrep)
to the stage layers so they can be replaced before the final
stdenv. This should cause most of stage4 to be built from the
toolchain assembled as of stage3 instead of the bootstrap toolchain.
2901f01 to
1aa04ca
Compare
thefloweringash
left a comment
There was a problem hiding this comment.
There are two commits here:
- the first is the minimal set of changes to produce a functional stdenv after updating the bootstrap tools
- the second is to try to improve the correctness of the bootstrapping change, and is not complete (looking for feedback)
The main change in the second commit is to match the toolchain wrapper in llvm/7/default.nix and include libcxxabi in extraPackages. Testing with only the first commit shows that it works without this, so maybe it's not important. In order to include libcxxabi, I had to be careful when building it to avoid a reference to the bootstrap version. For this I took the bootstrapping logic from llvm/7/default.nix [1], [2]. This existing bootstrapping logic is driven by stdenv.hostPlatform.useLLVM, which I initially expected to be true for Darwin as it is an llvm/clang based stdenv, but it appears to be unrelated (used for wasi cross compilation).
I've spent a bit of time inspecting the darwin stdenv. I noticed that the bootstrap tools don't appear to be swapped out incrementally through the stages as they are in linux. The second commit also includes an attempt to make this more well behaved.
| @@ -1,4 +1,5 @@ | |||
| { stdenv, cmake, fetch, libcxx, llvm, version | |||
| , standalone ? false | |||
There was a problem hiding this comment.
This has very similar effects to stdenv.hostPlatform.useLLVM, in supporting bootstraping an llvm/clang based toolchain. Though useLLVM is only defined in versions 8, 9, 10 and 11. We should find a consistent approach to this. If possible I'd like to remove useLLVM from llvm/*/libc++abi.nix for something reusable that describes its effects.
|
This has been subsumed by #98541. |
Adapted from main expression for clang 7.
Motivation for this change
Second part of #94426, and must only be merged when updating bootstrap tools to include #94426. See that ticket for the main context. This integrates compiler-rt into the toolchain, both from the re-added bootstrap level and for the higher level stdenvs.
I'm not confident about the composition of the stages or if compiler-rt is rebuilt at the appropriate times. The idea is to preserve the bootstrap version until llvm is available to build a new one.
cc @matthewbauer and @LnL7
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)