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.
| pushd "$dev" | |
| rmdir -p include/c++/v1 | |
| popd | |
| rmdir -p $dev/include/c++/v1 |
There was a problem hiding this comment.
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 <[email protected]>
toonn
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.
I've now changed it to headersOnly.
| sourceRoot = "source/libcxx"; | ||
|
|
||
| outputs = [ "out" "dev" ]; | ||
| outputs = [ "out" ] ++ lib.optional (!isCxxHeaders) "dev"; |
There was a problem hiding this comment.
Wouldn't it be simpler if dev would be the single output when only building the headers?
There was a problem hiding this comment.
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
| 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.
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.
I removed this change in the latest commit.
toonn
left a comment
There was a problem hiding this comment.
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_gitprobably 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 = trueset 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.shto update generated release notes