[Bug 792146] Re: clang can’t link any programs: cannot find crt1.o, crti.o, crtn.o

Leo Iannacone l3on at ubuntu.com
Sat Dec 10 20:16:28 UTC 2011


I fixed problem updating patch in
https://bugs.launchpad.net/ubuntu/+source/clang/+bug/896695

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to a duplicate bug report (896695).
https://bugs.launchpad.net/bugs/792146

Title:
  clang can’t link any programs: cannot find crt1.o, crti.o, crtn.o

Status in The Low Level Virtual Machine Compiler Infrastructure:
  Confirmed
Status in “clang” package in Ubuntu:
  Confirmed
Status in “clang” package in Debian:
  Fix Released

Bug description:
  Binary package hint: clang

  clang in 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 foo.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 foo.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.51.20110421 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/2.9 -ferror-limit 19 -fmessage-length 80 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-d3WZZO.o -x c foo.c
  clang -cc1 version 2.9 based upon llvm 2.9 hosted on x86_64-pc-linux-gnu
  #include "..." search starts here:
  #include <...> search starts here:
   /usr/local/include
   /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 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o crtbegin.o -L -L/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/../../.. /tmp/cc-d3WZZO.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/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)

  $ find /usr -name crtbegin.o -o -name libgcc.so -o -name libgcc_s.so
  /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6/crtbegin.o
  /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6/libgcc_s.so
  /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6/32/crtbegin.o
  /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6/32/libgcc_s.so
  /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/crtbegin.o
  /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libgcc_s.so

  $ strace clang foo.c |& grep 'crtbegin\.o'
  stat("/usr/lib/gcc//4.5.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.5.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.5.1/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.5.1/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.5/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.5/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.4.5/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.4.5/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.4.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.4.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.4.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.4.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.3.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.3.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.3.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.3.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.3.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.3.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.2.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.2.4/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.2.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.2.3/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.2.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.2.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.2.1/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.2.1/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/gcc//4.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/usr/lib64/gcc//4.2/crtbegin.o", 0x7fff1cfc8600) = -1 ENOENT (No such file or directory)
  stat("/crtbegin.o", 0x7fff1cfc8780)     = -1 ENOENT (No such file or directory)
  stat("/../../../../lib64/crtbegin.o", 0x7fff1cfc8780) = -1 ENOENT (No such file or directory)
  stat("/lib/../lib64/crtbegin.o", 0x7fff1cfc8780) = -1 ENOENT (No such file or directory)
  stat("/usr/lib/../lib64/crtbegin.o", 0x7fff1cfc8780) = -1 ENOENT (No such file or directory)
  stat("/../../../crtbegin.o", 0x7fff1cfc8780) = -1 ENOENT (No such file or directory)
  wait4(28765, /usr/bin/ld.bfd.real: cannot find crtbegin.o: No such file or directory

  Perhaps clang needs to be taught harder about multiarch paths?

  ProblemType: Bug
  DistroRelease: Ubuntu 11.10
  Package: clang 2.9-1
  ProcVersionSignature: Ubuntu 2.6.39-3.10-generic 2.6.39
  Uname: Linux 2.6.39-3-generic x86_64
  NonfreeKernelModules: openafs
  Architecture: amd64
  Date: Thu Jun  2 20:56:07 2011
  EcryptfsInUse: Yes
  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20101202)
  ProcEnviron:
   LANGUAGE=en_US:en
   PATH=(custom, user)
   LANG=en_US.utf8
   SHELL=/bin/bash
  SourcePackage: clang
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/llvm/+bug/792146/+subscriptions



More information about the Ubuntu-sponsors mailing list