llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.6k stars 11.82k forks source link

clang --print-runtime-dir incorrect output #112458

Open TerrorJack opened 5 days ago

TerrorJack commented 5 days ago

On x86_64 ubuntu 24.10, clang-19 --print-runtime-dir outputs /usr/lib/llvm-19/lib/clang/19/lib/x86_64-pc-linux-gnu, but the directory doesn't exist. The runtime libs are located in /usr/lib/llvm-19/lib/clang/19/lib/linux instead. This issue is present in clang-19 provided by ubuntu official repo as well as apt.llvm.org, and not present in the Linux-X64 binary distribution listed in a recent github release, so likely a packaging issue.

llvmbot commented 5 days ago

@llvm/issue-subscribers-clang-driver

Author: Cheng Shao (TerrorJack)

On x86_64 ubuntu 24.10, `clang-19 --print-runtime-dir` outputs `/usr/lib/llvm-19/lib/clang/19/lib/x86_64-pc-linux-gnu`, but the directory doesn't exist. The runtime libs are located in `/usr/lib/llvm-19/lib/clang/19/lib/linux` instead. This issue is present in `clang-19` provided by ubuntu official repo as well as `apt.llvm.org`, and not present in the `Linux-X64` binary distribution listed in a recent github release, so likely a packaging issue.
vszakats commented 3 days ago

Bumped into this:

++ clang-19 -print-runtime-dir
+ ccrtdir=/usr/lib/llvm-19/lib/clang/19/lib/x86_64-pc-linux-gnu  <------ should be?: /usr/lib/llvm-19/lib/clang/19/lib/linux
++ clang-19 -print-libgcc-file-name -rtlib=compiler-rt
+ ccrtlib=/usr/lib/llvm-19/lib/clang/19/lib/linux/libclang_rt.builtins-x86_64.a
++ basename /usr/lib/llvm-19/lib/clang/19/lib/linux/libclang_rt.builtins-x86_64.a
++ cut -c 4-
+ ccrtlib=clang_rt.builtins-x86_64.a
[...]
: && /usr/bin/clang-19 --target=x86_64-unknown-linux-musl -Wno-unused-command-line-argument
  -fstrict-flex-arrays=3 -fstack-protector-all -fPIC -fstack-clash-protection -fno-omit-frame-pointer
  -fcf-protection=full -fvisibility=hidden -fno-semantic-interposition -fno-unwind-tables
  -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -nostdinc
  -isystem /usr/lib/llvm-19/lib/clang/19/include -isystem /usr/include/x86_64-linux-musl
  -D_FORTIFY_SOURCE=2  -Wl,-z,relro,-z,now -Wl,-z,noexecstack -Wl,-z,nodlopen
  -Wl,-z,cet-report=warning -Wl,-z,force-ibt,-z,shstk -Wl,-Bsymbolic -Wl,--gc-sections
  -Wl,--icf=all -fuse-ld=lld-19 -Wl,-s -Wl,--build-id=none -nostdlib -nodefaultlibs
  -nostartfiles /usr/lib/x86_64-linux-musl/crt1.o /usr/lib/x86_64-linux-musl/crti.o
  /usr/lib/x86_64-linux-musl/crtn.o
  -L/usr/lib/x86_64-linux-musl
  -L/usr/lib/llvm-19/lib/clang/19/lib/x86_64-pc-linux-gnu -Wl,-lc
  -Wl,-lclang_rt.builtins-x86_64  CMakeFiles/cmTC_aa8c5.dir/testCCompiler.c.o
  -o cmTC_aa8c5   && :
ld.lld-19: error: unable to find library -lclang_rt.builtins-x86_64
clang-19: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

https://github.com/curl/curl-for-win/actions/runs/11383761271/job/31670072686