-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Fixes for pkgsLLVM with llvmPackages_{15,16,git} #246577
Conversation
8b5b8d6
to
008ee1d
Compare
Improved the commit message; building nix with pkgsLLVM also works on aarch64-linux. I've also got an aarch64-darwin build going but it's going to take a long time and the first time around failed in an LLVM test called |
I cherry-picked this PR and #241692 onto staging to build and test the Darwin stdenv update. |
That’s interesting. I’ve only encountered a few transient failures on x86_64-darwin while working on the stdenv update. Unfortunately, I can’t remember off hand what they were. In general, the tests should run successfully. |
The aarch64-darwin stdenv built after I made the cc-flags change conditional. I’m building x86_64-darwin now, which I’ll check in the morning. I deleted my comments regarding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank for the speedy reviews.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Rebased against current master and applied relevant fixes for llvmPackages_15, which allows them to build.
I haven't yet dug into this further, but I would prefer not to hold up landing this; those other issues can be found and fixed by others wanting to experiment with this toolchain. I haven't yet looked at llvmPackages_git. |
This comment was marked as resolved.
This comment was marked as resolved.
@RaitoBezarius please take another look, I've addressed your question.
I've applied the changes to LLVM git and LLVM 15. |
badd8c3cb8ecf9a99465aac53b40b353f25a8e4a fixed the infinite recursion issue I hit earlier. The git log suggests that you added that fix to LLVM 16 when it landed. |
OK, I checked a nixpkgs-review and this builds. |
What changed: * Fixed crtbeginS.o and crtendS.o missing (they may or may not be called crt{begin_end},{,_shared}. * Fixed implicit function declaration causing build errors for various builds by supplying -Wno-implicit-function-declaration. * Fixed __cxxabi_config.h missing, by adding -I${cxxabi}/include/c++/v1 in the wrapper. * Fixed libcxx failing to build due to missing libunwind symbols by including libunwind as a buildInput, and setting -DLIBCXX_ADDITIONAL_LIBRARIES=unwind for stdenv.hostPlatform.useLLVM == true. * libcxxabi wants to find libunwind at libunwind_shared.so, so symlink it there in libunwind. * llvmPackages_16.libcxxabi: Pass -nostdlib via CMAKE_*_LINKER_FLAGS Without this flag, the link of libcxxabi.so tries to pull in libgcc and friends, from the clang compiler driver. * Drop unneeded musl hack patch from libcxx. * Pass -Wno-error=implicit-function-declaration only to compiler-rt See LLVM forum discussion: https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213 In summary, LLVM 16 made implicit function declaration an error. This happens a lot in configure scripts which can break things. * llvmPackages_16: !isDarwin: Supply -DLIBCXX_ABI_USE_LLVM_UNWINDER=On Otherwise it fails with various undefined references to _Unwind_* functions: (full list: _Unwind_DeleteException _Unwind_GetIP _Unwind_GetLanguageSpecificData _Unwind_GetRegionStart _Unwind_RaiseException _Unwind_Resume _Unwind_SetGR _Unwind_SetIP). * 16.libcxxabi: Only pass -nostdlib for useLLVM and Darwin builds What was tested: * x86_64-linux, aarch64-linux, the stdenv builds. * Additionally I was able to get nix to build, with an overlay to fix a couple of minor issues in downstream packages (overlay supplied in PR NixOS#246577. * aarch64-darwin fails spuriously in a single LLVM test strip-preserve-atime.test checking atime timestamps. * The same for pkgsLLVM with llvmPackages = llvmPackages_15. Signed-off-by: Peter Waller <p@pwaller.net>
Signed-off-by: Peter Waller <p@pwaller.net>
# libcxxabi's CMake looks as though it treats -nostdlib++ as implying -nostdlib, | ||
# but that does not appear to be the case for example when building | ||
# pkgsLLVM.libcxxabi (which uses clangNoCompilerRtWithLibc). | ||
"-DCMAKE_EXE_LINKER_FLAGS=-nostdlib" | ||
"-DCMAKE_SHARED_LINKER_FLAGS=-nostdlib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for this? I would think we do wanna link libc but don't want to link (an already-existing) C++ standard library implementation. -nostdlib++
without -nostdlib
therefore seems correct to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, this is coming back to it some time after I implemented it, so I have forgotten the detail here and I have limited cycles to spare to dive back in. I suspect it has to do with making cmake configure, or linking succeed. I presume if you take it out you'll find the same failure I experienced? If not, maybe there is something further downstream which is broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks @pwaller. So far, it actually seems to be working fine for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comment is ambigous with two possible meanings:
- So far it works fine with the lines removed (as I suggested)
- So far it works fine as it currently is (with my lines present)
I read your intended response as (2).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cross reference. I looked into it a little, I suspect the issue this was trying to fix went away when libcxxabi was merged into libcxx.
Description of changes
cc maintainers @dtzWill @Ericson2314 @lovek323 @primeos @qyliss @RaitoBezarius @rrbutani @sternenseemann
With the following overlay, I'm able to build and run
pkgsLLVM.nix
(i.e, nontrivial C++ software) with LLVM 16.As others have observed, the runtimes build machinery changed quite a bit in recent LLVM versions, so it was a little tricky to make this work, and I've had to tweak the build a bit. I suspect my tweaks may be have the potential to break other platforms, so help wanted!
Overlay:
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)