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

Bug Watch Updater 792146 at bugs.launchpad.net
Sun Nov 27 01:21:57 UTC 2011


Launchpad has imported 2 comments from the remote bug at
http://llvm.org/bugs/show_bug.cgi?id=11440.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2011-11-27T00:51:58+00:00 Leo Iannacone wrote:

Dear developers,

I would like to discuss with you some solution to take away hardcoded
codenames in ToolChains.cpp.

For example, Debian and (in particular) Ubuntu need to patch and add by-
their-hands Distro names in the code every release.

Ubuntu needs upgrade patch every six months.

My question is: does exist another way in which ToolChains.cpp should be
"written" or "conceived" in order to simplify this process?

In this discussion Anders Kaseorg explains the problem very well:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-June/015545.html


Best regards,

Leo.

Reply at: https://bugs.launchpad.net/llvm/+bug/792146/comments/15

------------------------------------------------------------------------
On 2011-11-27T00:58:00+00:00 Chandler Carruth wrote:

The ToolChains.cpp system has been completely rewritten since the thread
you cite was written. The specific complaints mentioned there have been
fixed (if not in the exact way proposed).

What is actually causing problems? Do you actually need to patch Clang
today?

For reference, I have tested the current 3.0 release candidate on both
Debian and Ubuntu without *any* patches applied and I believe it found
the correct GCC installation and headers.

Reply at: https://bugs.launchpad.net/llvm/+bug/792146/comments/16


** Changed in: llvm
       Status: Unknown => Confirmed

** Changed in: llvm
   Importance: Unknown => Wishlist

-- 
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