Comment 5 for bug 792146

Revision history for this message
Ilmari Vacklin (wolverian) wrote : Re: clang can’t link any programs: cannot find crtbegin.o, -lgcc, -lgcc_s

I'm getting something similar on Oneiric 64-bit. Does it look like this bug? Output of clang -v attached below.

    ➜ tmp git:(ubuntu) ✗ cat trivial.c
    #include <stdio.h>

    int main() {
        printf("Hello World");
        return 0;
    }
    ➜ tmp git:(ubuntu) ✗ clang trivial.c -v
    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 trivial.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.53.20110810 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/2.9 -ferror-limit 19 -fmessage-length 127 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-cj0i6G.o -x c trivial.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" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out crt1.o crti.o crtbegin.o -L -L/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/../../.. /tmp/cc-cj0i6G.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o crtn.o
    /usr/bin/ld: cannot find crt1.o: No such file or directory
    /usr/bin/ld: cannot find crti.o: No such file or directory
    /usr/bin/ld: cannot find crtbegin.o: No such file or directory
    /usr/bin/ld: cannot find -lgcc
    /usr/bin/ld: cannot find -lgcc_s
    clang: error: linker command failed with exit code 1 (use -v to see invocation)