[cfe-dev] Making libc++ on Linux user-friendly

Sebastian Redl sebastian.redl at getdesigned.at
Mon Mar 31 10:03:53 PDT 2014


On 2014-03-31 17:55, David Chisnall wrote:
> On 31 Mar 2014, at 16:27, Sebastian Redl <sebastian.redl at getdesigned.at> wrote:
>
>> The other problem is this: how do we make it so that no additional command line flags are required, no matter what ABI library is used? Ideally, the libc++.so would just tell the linker to pull the ABI library into the link, or claim to export the symbols itself but really just forward to the underlying library.
> This is what we do on FreeBSD:
>
> $ cat /usr/lib/libc++.so                                                                                                                                                        
> /* $FreeBSD: release/10.0.0/lib/libc++/libc++.ldscript 253917 2013-08-03 16:23:43Z dim $ */
> GROUP ( /usr/lib/libc++.so.1 /usr/lib/libcxxrt.so )
>
> This allows -stdlib=libc++ to just add -lc++ to the ld command line and Just Work™.  It also meant that we could add or remove dependencies without having to alter linker command lines.  We do the same thing with libc.so, and I'd recommend that this be the default way of installing libc++ on Linux.  Then clang++ (or g++) just needs to know to link to libc++ and doesn't need to know anything about the specific configuration.  
>
This is great!

Generating this file with CMake is easy, esp. since I don't actually
need to know where the ABI library is; the linker is fine with
-lstdlibc++ in the file.

Now I just need to figure out how to make CMake use that as libc++.so
instead of the symlink the library target creates.

Sebastian



More information about the cfe-dev mailing list