-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
llvmPackages_13.libcxx: fix darwin build #147289
Conversation
I'm marking this as draft because I found out that building
|
2b1f2e1
to
944de65
Compare
944de65
to
e157b5d
Compare
This is now ready for review. LLVM, Clang, and libcxx all built successfully after I replaced |
pushd "$dev" | ||
rmdir -p include/c++/v1 | ||
popd |
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.
pushd "$dev" | |
rmdir -p include/c++/v1 | |
popd | |
rmdir -p $dev/include/c++/v1 |
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.
I believe this would result in different behavior. I want the directories v1
, c++
, and include
to be deleted in order while making sure that each of those directories are completely empty before deletion. The suggested change would also attempt to delete each path component in $dev
too.
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
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.
Looks like a good fix overall.
inherit llvm_meta; | ||
stdenv = if stdenv.hostPlatform.useLLVM or false | ||
libcxxabi = let | ||
stdenv_ = if stdenv.hostPlatform.useLLVM or false |
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.
I think what you want to do here is test stdenv.cc.isClang
. useLLVM
isn't true for Darwin, for example. (Unless that changed recently?)
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.
I'm not exactly sure what the intention behind that conditional expression is, so I left it unchanged in this PR. Does your suggestion apply to other parts of the code too? I see the same conditional expression used everywhere throughout the LLVM packaging code.
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.
Hmm, I guess leave it if you've tested it on Darwin anyway?
cxx-headers = callPackage ./libcxx { | ||
inherit llvm_meta; | ||
stdenv = stdenv_; | ||
isCxxHeaders = true; |
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.
I've seen headersOnly
as the argument for triggering a headers only build a couple times, might be nice to align with that convention?
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.
I've now changed it to headersOnly
.
|
||
outputs = [ "out" "dev" ]; | ||
outputs = [ "out" ] ++ lib.optional (!isCxxHeaders) "dev"; |
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.
Wouldn't it be simpler if dev would be the single output when only building the headers?
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.
I tried, but it failed to evaluate when I did this.
❯ nix-build -A llvmPackages_13.libcxx
these 3 derivations will be built:
/nix/store/9za4wnq6g4kzls8kda2lma2axhppgis4-cxx-headers-13.0.0.drv
/nix/store/yhfjvzqrz6d1rs8d7mfifsvm4i6c0rdd-libcxxabi-13.0.0.drv
/nix/store/2c18dsqr57z2sl6bw0y85ziz44349jn7-libcxx-13.0.0.drv
building '/nix/store/9za4wnq6g4kzls8kda2lma2axhppgis4-cxx-headers-13.0.0.drv'...
Error: _assignFirst found no valid variant!
pkgs/top-level/all-packages.nix
Outdated
@@ -12578,6 +12578,8 @@ with pkgs; | |||
targetLlvmLibraries = targetPackages.llvmPackages_13.libraries; | |||
} // lib.optionalAttrs (stdenv.hostPlatform.isi686 && buildPackages.stdenv.cc.isGNU) { | |||
stdenv = gcc7Stdenv; | |||
} // lib.optionalAttrs stdenv.hostPlatform.isDarwin { |
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.
Note that the LLVM bump to 11 #126411 was just merged to staging so I don't think it's necessary to explicitly pick the LLVM version here.
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.
I removed this change in the latest commit.
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.
LGTM, didn't have time to run test builds though.
Backport failed for Please cherry-pick the changes locally. git fetch origin release-21.11
git worktree add -d .worktree/backport-147289-to-release-21.11 origin/release-21.11
cd .worktree/backport-147289-to-release-21.11
git checkout -b backport-147289-to-release-21.11
ancref=$(git merge-base d71611fb7221eaa8804a355ca22fadecacc4b9f6 7994b1dfc0a5431cbb4c052c740db8992045af8c)
git cherry-pick -x $ancref..7994b1dfc0a5431cbb4c052c740db8992045af8c |
Motivation for this change
This succeeds #146517. It fixes the Darwin build of libcxx by applying the following fixes:
The Linux build seems to have avoided the circular dependency problem by dropping the libcxx dependency on libcxxabi. This approach appears not to be possible on Darwin.
llvmPackages_git
probably needs the same fix too, but I haven't looked into it closely yet.ZHF: #144627
Things done
Like in #146517, I've tested on the master branch and rebased against staging to avoid the overwhelming amount of local builds.
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/
)nixos/doc/manual/md-to-db.sh
to update generated release notes