llvmPackages.libunwind: condition doFakeLibgcc on !stdenv.hostPlatform.isStatic#417354
llvmPackages.libunwind: condition doFakeLibgcc on !stdenv.hostPlatform.isStatic#417354alyssais merged 1 commit intoNixOS:masterfrom
Conversation
…m.isStatic Since NixOS#380683, broken symlinks prevent the package from building on pkgsStatic.pkgsLLVM. So far as I know, isStatic builds don't have shared objects, so don't emit these broken symlinks for them. Signed-off-by: Peter Waller <p@pwaller.net>
| libcxx, | ||
| enableShared ? !stdenv.hostPlatform.isStatic, | ||
| doFakeLibgcc ? stdenv.hostPlatform.useLLVM, | ||
| doFakeLibgcc ? stdenv.hostPlatform.useLLVM && !stdenv.hostPlatform.isStatic, |
There was a problem hiding this comment.
This isn't right, we can easily fix the error by referring to the library extension in hostPlatform.
nixpkgs/lib/systems/default.nix
Line 192 in f4c841a
There was a problem hiding this comment.
It's more complicated than this because:
- I don't think we should be making libgcc available if we're stdenv.hostPlatform.useLLVM and it's static. (At least, if we do, I'm unaware of a use case, because this never worked before, so I'm unaware of an obvious test case for this)
libgcc_sis the shared version, I think the static version is a combination oflibgcc.aandlibgcc_eh.a, or something like this.
See for example: #177129
One possibility here is to provide a libgcc_eh.a in this case, which I think would provide a workaround the above bug. One way to provide libgcc_eh.a is just to do touch libgcc_eh.a, which provides a valid empty ar file. I believe there is nothing provided by libgcc_eh which isn't provided by libunwind in nixpkgs' typical scenarios with useLLVM && isStatic.
IIUC, the problem is rooted in GCC providing different libraries depending on whether it was compiled with --enable-shared, and clang doesn't know about this (or at least didn't, last time I checked), so it always requests libgcc_eh even though sometimes it doesn't exist. I'm currently thinking there must be another workaround for this somewhere because it has been a while since I hit it.
So, I might propose to touch libgcc_eh in this case, and mark this as fixing #177129 too. Thoughts?
|
Ping @RossComputerGuy |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/build-error-llvmpackages-libunwind/66874/3 |
|
how is it possible to check if the build is still broken?
|
…rom `nixos-24.11` libunwind is broken in "nixpkgs#pkgsCross.musl64.pkgsStatic.pkgsLLVM.libunwind", see NixOS/nixpkgs#417354 This hack is not the best solution, but it's the only one I was able to hack together. I think it would be better to override `libunwind` in `stdenv`, but I wasn't able to do that.
|
|
|
@RossComputerGuy okay, but what is? What is the derivation that is being fixed by this PR? |
|
|
|
@RossComputerGuy do you have any thoughts on my comment above? Is this actionable or dead? Can we move this forward in that it improves upon the status quo? |
I'm not sure this is really what I have a problem with. Here's a command that fails for me in the first place, and the relevant output: $ nix-shell -p llvmPackages.libunwind --arg crossSystem "{ config = \"x86_64-unknown-linux-musl\"; useLLVM = true; isStatic = true; }"
error: builder for '/nix/store/37c7kf9nxrp464jqnfgj3qs82x77m7cf-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv' failed with exit code 1;
error: build of '/nix/store/37c7kf9nxrp464jqnfgj3qs82x77m7cf-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv', '/nix/store/x5lg2794qwshhf2wn7x1xjs7w3lm4jqy-stdenv-darwin.drv' failedHere's output for the package I found to be broken: $ nix build "nixpkgs#pkgsCross.musl64.pkgsStatic.pkgsLLVM.libunwind"
error: builder for '/nix/store/37c7kf9nxrp464jqnfgj3qs82x77m7cf-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv' failed with exit code 1;
error: 1 dependencies of derivation '/nix/store/0lwi60brs5hh3ra6kx6mvxx6r2k3pcjq-x86_64-unknown-linux-musl-clang-wrapper-19.1.7.drv' failed to build
error: 1 dependencies of derivation '/nix/store/x5lg2794qwshhf2wn7x1xjs7w3lm4jqy-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bww0w4qvmqc6mqsz2v46vyk78ibdv2if-libunwind-static-x86_64-unknown-linux-musl-1.8.1.drv' failed to buildHere's the output for $ nix build "nixpkgs#pkgsCross.musl64.pkgsStatic.llvmPackages.libunwind"
$ readlink result
/nix/store/5q7hm778z78kg0dzsgzk16p66rargvqn-libunwind-static-x86_64-unknown-linux-musl-19.1.7
$ ls -la result/lib
.r--r--r-- 136k root 1 Jan 1970 result/lib/libunwind.aSo to summarise:
Upd: just to be sure, I tried building a failing package in |
|
We don't support this on Darwin, please use a Linux system. |
I think it's good. |
this doesn't work on my linux CI either, but it takes forever to push to CI and wait for it to break, trying to guess what is the correct package name to try building. On Linux, we still run a cross compilation build, because it's set up that way and I am not really up to changing this. Upd: this is the output of the initial whole broken build on Linux machine: ERROR: noBrokenSymlinks: the symlink /nix/store/3lybj15xkhmnwijflvyfahki2y8ckica-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libgcc_s.so points to a missing target: /nix/store/3lybj15xkhmnwijflvyfahki2y8ckica-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libunwind.so
ERROR: noBrokenSymlinks: the symlink /nix/store/3lybj15xkhmnwijflvyfahki2y8ckica-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libgcc_s.so.1 points to a missing target: /nix/store/3lybj15xkhmnwijflvyfahki2y8ckica-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libunwind.so
ERROR: noBrokenSymlinks: found 2 dangling symlinks, 0 reflexive symlinks and 0 unreadable symlinks
error: builder for '/nix/store/r51r87qla7afsk1qlml8iz7zzmk716qw-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/2y2qvjgmq3js76mhijh4nnixdxa51qqd-x86_64-unknown-linux-musl-clang-wrapper-19.1.7.drv' failed to build
error: 1 dependencies of derivation '/nix/store/shwq2yrnzr02dz3fxid7rjl2qsksa4rp-rust-default-1.88.0.drv' failed to build
error: build of '/nix/store/jb8v8041cbrwhyxqv86flkklz3bzrzhb-docker-27.5.1.drv', '/nix/store/mvcsvkk35r1pm2zw2hl26zcfkj2m5c0l-stdenv-linux.drv', '/nix/store/shwq2yrnzr02dz3fxid7rjl2qsksa4rp-rust-default-1.88.0.drv' failed |
|
Hmm, I'll give it a try after work tonight. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Since #380683, broken symlinks prevent the package from building on pkgsStatic.pkgsLLVM.
So far as I know, isStatic builds don't have shared objects, so don't emit these broken symlinks for them.
Closes #431439
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.