Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 388801

Summary: sys-devel/clang-9999 fails to find crtbegin.o & -lgcc* for linking
Product: Gentoo Linux Reporter: Michał Górny <mgorny>
Component: Current packagesAssignee: Bernard Cafarelli <voyageur>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-10-28 17:10:46 UTC
$ clang a.c -v
clang version 3.1 (trunk)
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 a.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.1 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 105 -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/a-eEsc7I.o -x c a.c
clang -cc1 version 3.1 based upon llvm 3.1svn hosted on x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.1/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/include
End of search list.
 "/usr/bin/x86_64-pc-linux-gnu-ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o crtbegin.o -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib /tmp/a-eEsc7I.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /usr/lib/../lib64/crtn.o
/usr/bin/x86_64-pc-linux-gnu-ld: cannot find crtbegin.o: No such file or directory
/usr/bin/x86_64-pc-linux-gnu-ld: cannot find -lgcc
/usr/bin/x86_64-pc-linux-gnu-ld: cannot find -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What's interesting, the build log states:

checking for the default library search path... /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64 /lib32 /usr/lib32 /usr/local/lib32 /lib /usr/lib /usr/local/lib /usr/x86_64-pc-linux-gnu/lib /usr/lib32/opengl/xorg-x11/lib /usr/lib64/opengl/xorg-x11/lib /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3 /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/32 /usr/lib64/qt4 /usr/lib32/qt4 /usr/lib/qt4 /usr/games/lib64 /usr/games/lib32 /usr/games/lib 

Adding -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3 fixes the -lgcc* errors but it is still unable to find crtbegin.o.
Comment 1 Bernard Cafarelli gentoo-dev 2011-11-08 13:54:07 UTC
Thanks for the report! It could be a duplicate of bug #387309, can you test the suggested fixes there?

I'll start working on 3.0rc1 ebuilds soon so I'll be able to test this too
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-11-08 19:32:29 UTC

*** This bug has been marked as a duplicate of bug 387309 ***