clang is unable to link binaries/libraries

Bug #852870 reported by Mina Galić
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
clang (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

*compiling* a simple test program such as this

int
main ()
{

  ;
  return 0;
}

works out fine:
$ clang -v -c conftest.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 conftest.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 239 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o conftest.o -x c conftest.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.
$

Linking it however, does not:
$ clang -v -o conftest conftest.o
clang version 2.9 (tags/RELEASE_29/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
 "/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o conftest crt1.o crti.o crtbegin.o -L -L/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/../../.. conftest.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.bfd.real: cannot find crt1.o: No such file or directory
/usr/bin/ld.bfd.real: cannot find crti.o: No such file or directory
/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)
$

I am currently rebuilding clang/llvm-2.9 to verify if the information I found on the internet is true:
"gcc used to build clang is not in a standard location" http://stackoverflow.com/questions/5637178/clang-2-9-crt1-not-found-error

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: clang 2.9-8
ProcVersionSignature: Ubuntu 3.0.0-11.17-generic 3.0.4
Uname: Linux 3.0.0-11-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 1.22.1-0ubuntu2
Architecture: amd64
Date: Sun Sep 18 00:11:38 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/usr/bin/zsh
SourcePackage: clang
UpgradeStatus: Upgraded to oneiric on 2011-07-14 (65 days ago)

Related branches

Revision history for this message
Mina Galić (minagalic) wrote :
Revision history for this message
Mina Galić (minagalic) wrote :

nope, even after my rebuild of the package, the only thing it does manage to find is -lc

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package clang - 2.9-11ubuntu1

---------------
clang (2.9-11ubuntu1) oneiric; urgency=low

  * Add support for Ubuntu natty and oneiric (LP: #792146, #852870).
 -- Colin Watson <email address hidden> Sun, 18 Sep 2011 22:43:25 +0100

Changed in clang (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.