[cfe-dev] Clang 3.1: Can't link Hello World-program program on Linux
fat.lobyte9 at gmail.com
Thu Mar 1 04:03:56 CST 2012
I am currently trying to build a Hello World-program on Fedora 16 using
Clang from Subversion:
clang version 3.1 (trunk 151711)
Thread model: posix
When building without "--stdlib=libc++", I run into compile-time-errors
in the GNU implementation of the IOstream library.
So I built libc++ (with the above compiler), using the workaround
suggested in this thread:
With the "--stdlib=libc++" option, the linking of the program fails,
asking for some symbols from the CXXABI:
$ clang++ --stdlib=libc++ -o helloworld helloworld.cpp
/usr/bin/ld: /tmp/helloworld-Jxd2ZV.o: undefined reference to symbol
/usr/bin/ld: note: '__cxa_begin_catch@@CXXABI_1.3' is defined in DSO
/usr/lib64/libstdc++.so.6 so try adding it to the linker command line
/usr/lib64/libstdc++.so.6: could not read symbols: Invalid operation
clang-3: error: linker command failed with exit code 1 (use -v to see
What did I do wrong? Is Clang or libcxx misconfigured, or is this a
compiler bug? How could I fix or work around the issue?
I'd love to use Clang for some testing of C++11, since it gained a lot
support recently (thanks a lot by the way! Kudos to Clang hackers!).
More information about the cfe-dev