[cfe-dev] Building libc++ on Linux

David Chisnall theraven at sucs.org
Wed Mar 28 05:41:18 PDT 2012


Building libc++ on any platform is not a task for the faint hearted...

It involves making several decisions:

- Which ABI library are you going to choose.  The current options are:

	- libsupc++, which is the most mature but is covered by the same license as GNU libstdc++

	- libcxxrt, which is BSD licensed and has been used in production on Linux, NetBSD, FreeBSD and Solaris (and is now imported into the FreeBSD tree as a libsupc++ replacement), but is still newer than libsupc++.

	- libc++abi, which is part of LLVM but is the least mature of the lot

- Are you going to support linking libraries using libc++ with libraries linking libstdc++?  If so, then you must either link libc++ to libstdc++ or link both libstdc++ and libc++ to the same ABI library.  In FreeBSD, we link both to libcxxrt and compile libstdc++ as a filter library to allow for symbol versioning to continue to work and avoid breaking the ABI for programs that linked directly to libstdc++, which previously statically linked to libsupc++.  If not, then you can simply link libc++ to whichever ABI library you choose.

- Are you going to make any of the ABI interfaces public?  By default, libcxxrt does not install any of its headers because the ABI <-> STL interface is at least semiprivate, although libobjc2 depends on some parts of it (which are not supported by libc++abi, but are supported by libsupc++ and libcxxrt).   

Actually building libc++ itself is pretty trivial - just compile all of the source files and link them.  clang -std=c++0x -shared *.cpp -o libc++.so is about all that's needed, although you will need to add -I flags for finding the headers for your ABI-library-of-choice and a -l flag for linking to it.

Building it, however, is the easy part.  Deciding on how it will be installed and linked is much harder.

David

On 28 Mar 2012, at 12:25, Fletcher, John P wrote:

> It would be very helpful if the web pages were updated to give instructions for installation of libc++ on Linux.
> 
> There is also no information in the source code itself.  At least I could not find any.
> 
> There is some in past messages, including how to make cxxabi.h accessible for gcc 4.4 and 4.6.
> 
> John
> 
> Dr John P. Fletcher Tel: (44) 121 204 3389 (direct line), FAX: (44) 121 204 3678
> Chemical Engineering and Applied Chemistry (CEAC),
> formerly Associate Dean - External Relations,
> School of Engineering and Applied Science (EAS),
> Aston University, Aston Triangle, BIRMINGHAM B4 7ET  U.K.               
> 
> 
> 
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


-- Sent from my brain





More information about the cfe-dev mailing list