Bug#629861: clang 2.9 can’t link any programs on Ubuntu oneiric: cannot find crtbegin.o, -lgcc, -lgcc_s

Anders Kaseorg andersk at MIT.EDU
Wed Jun 8 22:34:18 UTC 2011


Package: clang
Version: 2.9-2

https://bugs.launchpad.net/ubuntu/+source/clang/+bug/792146

clang in Ubuntu oneiric doesn’t look for crtbegin.o, libgcc.so, or 
libgcc_s.so in the right place, so it can’t link any programs.

$ echo 'int main() {return 0;}' > foo.c

$ clang foo.c
/usr/bin/ld.bfd.real: cannot find crtbegin.o: No such file or directory
/usr/bin/ld.bfd.real: cannot find -lgcc
/usr/bin/ld.bfd.real: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

‘clang -v’ output is on the Launchpad bug.

Based on strace, it’s looking in /usr/{lib,lib64}/{4.5.2,4.5.1,4.5,…,4.2}, 
/, /../../../../lib64, /lib64, /usr/lib64, and /../../.. .  It seems to 
know nothing of the multiarch path where these actually live: 
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5 .

(Shouldn’t these paths be set and verified at configure time instead of 
“magically” detected at runtime by looking at /etc/debian_version and 
/etc/lsb-release(!) and guessing from a list of possible versions of gcc?)

Anders





More information about the Pkg-llvm-team mailing list