[cfe-dev] Clang 3.1: Can't link Hello World-program program on Linux

John McCall rjmccall at apple.com
Tue Mar 13 22:44:37 PDT 2012


On Mar 13, 2012, at 4:52 PM, David Chisnall wrote:
> On 13 Mar 2012, at 23:47, Alexander Korsunsky wrote:
>> 3) Please add a flag to link with the right library "-lc++abi" to the
>> linker command line in the compiler driver, if "-stdlib=libc++" was
>> specified. Maybe it is possible to check the dependencies of libc++
>> (like ldd?), and add the correct library to the command line.
> 
> This would be the wrong thing to do in almost all situations.  We are using libc++ with libcxxrt on Solaris and FreeBSD - adding -lc++abi would be just plain wrong (because we're not using libc++abi), and adding -lcxxrt is redundant because it is linked by libc++ so you don't need to link it twice.

Right.  The normal configuration should be to use the target platform's ABI library;  switching to libc++abi is a distro-maintainer decision more than it is an end-programmer decision.  For GNU/Linux, this library is libsupc++.  I don't know off-hand how well libc++ builds or runs on top of that, but I think bugs and patches (especially patches!) would be welcome, unless that would run us afoul of licensing in some bizarre way.

John.



More information about the cfe-dev mailing list