I’m having trouble building a package in cross-compilation mode, but the same package seems to build with nix build
:
in nixpkgs on commit 32a4e87942101f1c9f9865e04dc3ddb175f5f32e (top of nixos-25.05, same as the one I use with flakes that encounter a build error) this command works:
nix build ".#pkgsCross.musl64.llvmPackages.libunwind"
anywhere (I don’t understand where does the package definition comes in this case) these commands don’t:
nix-shell -p libunwind --arg crossSystem "{ config = \"x86_64-unknown-linux-musl\"; useLLVM = true; isStatic = true; }"
nix-shell -p llvmPackages.libunwind --arg crossSystem "{ config = \"x86_64-unknown-linux-musl\"; useLLVM = true; isStatic = true; }"
I have the following questions then: how do I choose what channel does nix-shell take packages from if I start it with package parameter? Is this pkgsCross.musl64.llvmPackages.libunwind
a correct target to try building on this error? It feels like isStatic
is important here, but I can’t understand how to pass it to nix build to open an issue in nixpkgs
I also don’t understand how to override llvmPackages.libunwind
that seems to come from stdenv
, but that’s a different story.
This happens on x86_64-linux
and aarch64-darwin
build machines
Relevant log from builder:
error: builder for '/nix/store/wanl0kzsjpiiccw2qh0p9xqp87rchw75-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv' failed with exit code 1;
last 25 log lines:
> clang++: warning: argument unused during compilation: '-rtlib=compiler-rt' [-Wunused-command-line-argument]
> [10/10] Linking C static library lib/libunwind.a
> Running phase: installPhase
> install flags: -j10 install
> [0/1] Install the project...
> -- Install configuration: "Release"
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/__libunwind_config.h
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/libunwind.h
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/libunwind.modulemap
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/mach-o/compact_unwind_encoding.h
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/unwind_arm_ehabi.h
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/unwind_itanium.h
> -- Installing: /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/unwind.h
> -- Installing: /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libunwind.a
> Running phase: fixupPhase
> shrinking RPATHs of ELF executables and libraries in /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7
> checking for references to /private/tmp/nix-build-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv-2/ in /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7...
> patching script interpreter paths in /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7
> stripping (with command x86_64-unknown-linux-musl-strip and flags -S) in /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib
> shrinking RPATHs of ELF executables and libraries in /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev
> checking for references to /private/tmp/nix-build-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv-2/ in /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev...
> patching script interpreter paths in /nix/store/488xbnlh769id2xbb08jf0768wiflqka-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev
> ERROR: noBrokenSymlinks: the symlink /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libgcc_s.so.1 points to a missing target: /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libunwind.so
> ERROR: noBrokenSymlinks: the symlink /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libgcc_s.so points to a missing target: /nix/store/yzinfvjxzyvg8c7ns47y2xmq5vbsklng-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
For full logs, run:
nix log /nix/store/wanl0kzsjpiiccw2qh0p9xqp87rchw75-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv
and
error: builder for '/nix/store/37c7kf9nxrp464jqnfgj3qs82x77m7cf-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv' failed with exit code 1;
last 25 log lines:
> clang++: warning: argument unused during compilation: '-rtlib=compiler-rt' [-Wunused-command-line-argument]
> [10/10] Linking C static library lib/libunwind.a
> Running phase: installPhase
> install flags: -j10 install
> [0/1] Install the project...
> -- Install configuration: "Release"
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/__libunwind_config.h
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/libunwind.h
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/libunwind.modulemap
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/mach-o/compact_unwind_encoding.h
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/unwind_arm_ehabi.h
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/unwind_itanium.h
> -- Installing: /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev/include/unwind.h
> -- Installing: /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libunwind.a
> Running phase: fixupPhase
> shrinking RPATHs of ELF executables and libraries in /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7
> checking for references to /private/tmp/nix-build-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv-2/ in /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7...
> patching script interpreter paths in /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7
> stripping (with command x86_64-unknown-linux-musl-strip and flags -S) in /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib
> shrinking RPATHs of ELF executables and libraries in /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev
> checking for references to /private/tmp/nix-build-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv-2/ in /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev...
> patching script interpreter paths in /nix/store/xgfcb37mdzp6ilcw6sc2h9av5zzxpy2r-libunwind-static-x86_64-unknown-linux-musl-19.1.7-dev
> ERROR: noBrokenSymlinks: the symlink /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libgcc_s.so.1 points to a missing target: /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libunwind.so
> ERROR: noBrokenSymlinks: the symlink /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-libunwind-static-x86_64-unknown-linux-musl-19.1.7/lib/libgcc_s.so points to a missing target: /nix/store/c0lclm5kvzamwmqsb9dsac02943x4zbm-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
For full logs, run:
nix log /nix/store/37c7kf9nxrp464jqnfgj3qs82x77m7cf-libunwind-static-x86_64-unknown-linux-musl-19.1.7.drv