Skip to content
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

Build failure: pkgsLLVM.busybox #314111

Closed
RossComputerGuy opened this issue May 23, 2024 · 2 comments · Fixed by #329817
Closed

Build failure: pkgsLLVM.busybox #314111

RossComputerGuy opened this issue May 23, 2024 · 2 comments · Fixed by #329817
Labels
0.kind: build failure 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@RossComputerGuy
Copy link
Member

Steps To Reproduce

Steps to reproduce the behavior:

  1. build pkgsLLVM.busybox

Build log

build flags: -j80 SHELL=/nix/store/1fzg4cl3k2n9yq80vg6y1vcmvx3qm682-bash-5.2p26/bin/bash SKIP_STRIP=y
applets/usage.c: In function 'main':
applets/usage.c:52:17: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |                 write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clang: warning: optimization flag '-finline-limit=0' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-falign-jumps=1' is not supported [-Wignored-optimization-argument]
clang: warning: optimization flag '-falign-labels=1' is not supported [-Wignored-optimization-argument]
aarch64-unknown-linux-gnu-ld: error: attempted static link of dynamic object /nix/store/2aqakjqjfj5kw644kkmyf3l30hk0x0rf-libunwind-aarch64-unknown-linux-gnu-17.0.6/lib/libunwind.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [scripts/Makefile.build:264: applets/built-in.o] Error 1
make: *** [Makefile:372: applets_dir] Error 2

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.

 - system: `"aarch64-linux"`
 - host os: `Linux 5.15.156, NixOS, 24.05 (Uakari), 24.05.20240418.bc279bb`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - nixpkgs: `/run/current-system/nixpkgs`

Add a 👍 reaction to issues you find important.

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 28, 2024
@pwaller
Copy link
Contributor

pwaller commented Jun 16, 2024

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)

@paparodeo
Copy link
Contributor

looks the same as #317526 which is due to llvm/llvm-project#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants