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.