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

David Chisnall David.Chisnall at cl.cam.ac.uk
Mon Mar 31 08:55:09 PDT 2014


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.  

David





More information about the cfe-dev mailing list