Open RossComputerGuy opened 2 months ago
This looks to me like the compiler wrapper isn't respecting -r
and/or -nostdlib
, and it's inappropriately passing the libunwind shared object. I don't have immediate time to investigate further but did discover this minimal reproducer:
$ nix shell nixpkgs/57d6973abba7ea108bac64ae7629e7431e0199b6#pkgsLLVM.stdenv.cc
$ touch test.c
$ x86_64-unknown-linux-gnu-cc -nostdlib -r -o test.o test.c
x86_64-unknown-linux-gnu-ld: error: attempted static link of dynamic object /nix/store/k3l71w9p5wcbzh0fqcjg0svbap8xla4g-libunwind-x86_64-unknown-linux-gnu-17.0.6/lib/libunwind.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
looks the same as https://github.com/NixOS/nixpkgs/issues/317526 which is due to https://github.com/llvm/llvm-project/issues/94958 (search path prefers .so files with -r
). i agree that passing in libunwind unconditionally seems not good.
if one builds libcxx with LLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind
the linker script at libc++.so
will result in INPUT(libc++.so.1 -lc++abi -lunwind)
but we don't so we add -lunwind
unconditionally. it is not clear to me why c code needs libunwind.
Steps To Reproduce
Steps to reproduce the behavior:
pkgsLLVM.busybox
Build log
Additional context
Add any other context about the problem here.
Notify maintainers
@TethysSvensson @alyssais
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.