Bug#695477: clang-3.2: undefined symbol -> cannot compile hello world

Ben Goodrich bg2382 at columbia.edu
Sat Dec 8 20:57:09 UTC 2012


Package: clang-3.2
Version: 3.2~rc3-1~exp1
Severity: important

When attempting to compile a C++ file such as

goodrich at CYBERPOWERPC:/tmp$ cat hello.cpp
#include<iostream>

int main() {
   std::cout << "Hello world" << std::endl;
   return 0;
}

it fails with

goodrich at CYBERPOWERPC:/tmp$ clang++ -v hello.cpp
Debian clang version 3.2-9 (tags/RELEASE_32/rc3) (based on LLVM 3.2)
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  
hello.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno  
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array  
-target-cpu x86-64 -target-linker-version 2.22  
-momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.2  
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem  
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7  
-internal-isystem  
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/x86_64-linux-gnu -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/backward -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++ -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/x86_64-linux-gnu -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/backward -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.2/include -internal-isystem /usr/include/clang/3.2/include/ -internal-externc-isystem  -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 191 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-mRmqIc.o -x c++  
hello.cpp
clang -cc1 version 3.2 based upon LLVM 3.2svn default target  
x86_64-pc-linux-gnu
ignoring nonexistent directory  
"/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu"
ignoring nonexistent directory  
"/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/x86_64-linux-gnu"
ignoring nonexistent directory  
"/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/backward"
ignoring nonexistent directory  
"/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/x86_64-linux-gnu"
ignoring nonexistent directory  
"/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/backward"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.2/include"
ignoring nonexistent directory ""
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
  /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7
  /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward
   
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7
  /usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++
  /usr/local/include
  /usr/include/clang/3.2/include
  /usr/include/x86_64-linux-gnu
  /usr/include
End of search list.
/usr/bin/clang: symbol lookup error: /usr/bin/clang: undefined symbol:  
_ZN4llvm11AttrListPtr3getERNS_11LLVMContextENS_8ArrayRefINS_18AttributeWithIndexEEE
clang: error: unable to execute command: Program could not be executed
clang: error: clang frontend command failed due to signal (use -v to  
see invocation)
Debian clang version 3.2-9 (tags/RELEASE_32/rc3) (based on LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to  
http://llvm.org/bugs/ and include the crash backtrace, preprocessed  
source, and associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/hello-oNDXNa.cpp
clang: note: diagnostic msg: /tmp/hello-oNDXNa.sh
clang: note: diagnostic msg:

********************

The problem persists if -stdlib=libc++ is added.
However, I have been able to compile C++ programs with clang-3.2 built  
from source on the LLVM website, clang-3.1 from Debian, and g++-4.7  
from Debian, e.g.

goodrich at CYBERPOWERPC:/tmp$ g++ -v hello.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian  
4.7.2-12' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs  
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr  
--program-suffix=-4.7 --enable-shared --enable-linker-build-id  
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext  
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7  
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu  
--enable-libstdcxx-debug --enable-libstdcxx-time=yes  
--enable-gnu-unique-object --enable-plugin --enable-objc-gc  
--with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32  
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu  
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-12)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
  /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -quiet -v -imultilib .  
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE hello.cpp -quiet -dumpbase  
hello.cpp -mtune=generic -march=x86-64 -auxbase hello -version -o  
/tmp/ccm0KsSV.s
GNU C++ (Debian 4.7.2-12) version 4.7.2 (x86_64-linux-gnu)
         compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR  
version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.7"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory  
"/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/include/c++/4.7
  /usr/include/x86_64-linux-gnu/c++/4.7/.
  /usr/include/c++/4.7/backward
  /usr/lib/gcc/x86_64-linux-gnu/4.7/include
  /usr/local/include
  /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
  /usr/include/x86_64-linux-gnu
  /usr/include
End of search list.
GNU C++ (Debian 4.7.2-12) version 4.7.2 (x86_64-linux-gnu)
         compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR  
version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 66eeca11cbd34088b4343227ee514019
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
  as -v --64 -o /tmp/ccQkDrKi.o /tmp/ccm0KsSV.s
GNU assembler version 2.22 (x86_64-linux-gnu) using BFD version (GNU  
Binutils for Debian) 2.22
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
  /usr/lib/gcc/x86_64-linux-gnu/4.7/collect2 --sysroot=/ --build-id  
--eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker  
/lib64/ld-linux-x86-64.so.2  
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o  
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o  
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o  
-L/usr/lib/gcc/x86_64-linux-gnu/4.7  
-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu  
-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib  
-L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu  
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../..  
/tmp/ccQkDrKi.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc  
/usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o  
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o
goodrich at CYBERPOWERPC:/tmp$ ./a.out
Hello world

I am attaching the requested files. Thank you.

-- System Information:
Debian Release: wheezy/sid
   APT prefers unstable
   APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.6-9.slh.1-aptosid-amd64 (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang-3.2 depends on:
ii  libc6                2.16-0experimental1
ii  libclang-common-dev  3.2~rc3-1~exp1
ii  libffi5              3.0.10-3
ii  libgcc-4.7-dev       4.7.2-12
ii  libgcc1              1:4.7.2-12
ii  libllvm3.2           3.2~rc1-1~exp1
ii  libobjc-4.7-dev      4.7.2-12
ii  libstdc++6           4.7.2-12
ii  libstdc++6-4.7-dev   4.7.2-12

Versions of packages clang-3.2 recommends:
ii  llvm-3.2-dev  3.2~rc1-1~exp3
ii  python        2.7.3-3

clang-3.2 suggests no packages.

-- no debconf information

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-oNDXNa.cpp
Type: text/x-c++src
Size: 1258207 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20121208/72800824/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-oNDXNa.sh
Type: application/x-shellscript
Size: 526 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20121208/72800824/attachment-0001.bin>


More information about the Pkg-llvm-team mailing list