Bug#639962: linking fails with clang

Miles Bader miles at gnu.org
Thu Sep 1 04:11:21 UTC 2011


Package: clang
Version: 2.9-9
Severity: normal


Even a trivial program fails to link when compiled with clang:

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

whereas gcc works properly:

   $ gcc -o hw ~/src/hw.c
   $ ./hw
   hello world
   $ 


Thanks,

-Miles


p.s., here's the output using "-v":

$ clang -v -o hw ~/src/hw.c
clang version 2.9 (tags/RELEASE_29/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hw.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.53.20110823 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/2.9 -ferror-limit 19 -fmessage-length 80 -fgnu-runtime -fdiagnostics-show-option -o /tmp/cc-B0Fb9z.o -x c /home/soft1/miles/src/hw.c
clang -cc1 version 2.9 based upon llvm 2.9 hosted on x86_64-pc-linux-gnu
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/bin/../lib/clang/2.9/include
 /usr/include
End of search list.
 "/usr/bin/ld" --hash-style=both --no-copy-dt-needed-entries --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o hw /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o crtbegin.o -L -L/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/../../.. -L/usr/lib/x86_64-linux-gnu /tmp/cc-B0Fb9z.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /usr/lib/x86_64-linux-gnu/crtn.o
/usr/bin/ld: error: cannot open crtbegin.o: No such file or directory
/usr/bin/ld: error: cannot open crtend.o: No such file or directory
/usr/bin/ld: error: cannot find -lgcc
/usr/bin/ld: error: cannot find -lgcc_s
/usr/bin/ld: error: cannot find -lgcc
/usr/bin/ld: error: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (50, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang depends on:
ii  libc6               2.13-18      
ii  libffi5             3.0.10~rc10-1
ii  libgcc1             1:4.6.1-8    
ii  libllvm2.9          2.9+dfsg-3   
ii  libstdc++6          4.6.1-8      
ii  libstdc++6-4.6-dev  4.6.1-8      

Versions of packages clang recommends:
ii  llvm-2.9-dev  2.9+dfsg-3
ii  python        2.6.7-3   

clang suggests no packages.

-- no debconf information





More information about the Pkg-llvm-team mailing list