From ec4de787e2f616d2ba1b82e1385554dfbbb8516f Mon Sep 17 00:00:00 2001
From: Dan Albert libc++ is known to work on the following platforms, using g++-4.2 and
- clang (lack of C++11 language support disables some functionality).
+ libc++ is known to work on the following platforms, using g++-4.2 and
+ clang (lack of C++11 language support disables some functionality). Note
+ that functionality provided by <atomic> is only functional with
+ clang.
+ First please review our
Developer's Policy.
- To check out the code, use:
On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to install
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
@@ -148,25 +149,106 @@
- Next:
- To check out the code, use:
- That should result in a libc++.1.dylib and libc++.dylib. The safest thing
- to do is to use it from where your libcxx is installed instead of replacing
- these in your Mac OS.
+ Note that for an in-tree build, you should check out libcxx to
+ llvm/projects.
- To use your system-installed libc++ with clang you can:
+ The following instructions are for building libc++ on FreeBSD, Linux, or Mac
+ using libc++abi as the C++ ABI
+ library. On Linux, it is also possible to use
+ libsupc++ or libcxxrt.
+ In-tree build: Out-of-tree build: To run the tests: If you wish to run a subset of the test suite: The above is currently quite inconvenient. Sorry! We're working on it! More information on using LIT can be found
+ here. For more
+ general information about the LLVM testing infrastructure, see the
+ LLVM Testing Infrastructure
+ Guide
+
+ Shared libraries for libc++ should now be present in llvm/build/lib. Note
+ that it is safest to use this from its current location rather than
+ replacing your system's libc++ (if it has one, if not, go right ahead).
+
+ Mac users, remember to be careful when replacing the system's libc++.
+ Your system will not be able to boot without a funcioning
+ libc++.
+
+ Building libc++ with Send discussions to the
+ clang mailing list.
+ To use your system-installed libc++ with clang you can:
- To use your tip-of-trunk libc++ on Mac OS with clang you can:
+ To use your tip-of-trunk libc++ on Mac OS with clang you can:
To run the libc++ test suite (recommended):
+ You will need to keep the source tree of
+ libc++abi available on your build
+ machine and your copy of the libc++abi shared library must be placed where
+ your linker will find it.
+
+ Unfortunately you can't simply run clang with "-stdlib=libc++" at this
+ point, as clang is set up to link for libc++ linked to libsupc++. To get
+ around this you'll have to set up your linker yourself (or patch clang).
+ For example:
+
+ Alternately, you could just add libc++abi to your libraries list, which in
+ most situations will give the same result:
+
-Building libc++ with Send discussions to the
- (clang mailing list).Platform Support
-
-
+
+
Current Status
@@ -134,12 +141,6 @@
-
-
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
/usr/lib
.
-
-
+
cd libcxx/lib
export TRIPLE=-apple-
./buildit
ln -sf libc++.1.dylib libc++.dylib
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
+
+
+ cd llvm
mkdir build && cd build
cmake .. # Linux may require -DCMAKE_C_COMPILER=clang
+ -DCMAKE_CXX_COMPILER=clang++
make cxx
+
+
+ cd libcxx
mkdir build && cd build
cmake -DLIBCXX_CXX_ABI=libcxxabi
+ -DLIBCXX_LIBCXXABI_INCLUDE_PATHS=path/to/libcxxabi/include
+ -DLIT_EXECUTABLE=path/to/llvm/utils/lit/lit.py .. # Linux may require
+ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
make
+
+
+ make check-libcxx
+
+ cd path/to/libcxx/libcxx
alias lit='python path/to/llvm/utils/lit/lit.py'
ln -s path/to/build/dir/projects/libcxx/test/lit.site.cfg
+ test/lit.site.cfg
lit -sv test/re/ # or whichever subset of tests you're interested
+ in
Notes
+
+
+ -fno-rtti
is not supported. However
+ linking against it with -fno-rtti
is supported.
+ Using libc++ in your programs
+
+
+
+ FreeBSD and Mac OS X
+
+
+
@@ -175,38 +257,46 @@
-
- export DYLD_LIBRARY_PATH=<path-to-libcxx>/lib
+ export DYLD_LIBRARY_PATH=path/to/build/lib
clang++ -std=c++11 -stdlib=libc++ -nostdinc++
-I<path-to-libcxx>/include -L<path-to-libcxx>/lib
test.cpp
Linux
+
+
+
-
-
- cd libcxx/test
./testit
-
+ testit
uses
- with export OPTIONS="whatever you need"
clang++ -stdlib=libc++ helloworld.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
Notes
-
+ -fno-rtti
is not supported. However linking
-against it with -fno-rtti
is supported.
-
+
clang++ -stdlib=libc++ helloworld.cpp -lc++abi
Bug reports and patches
@@ -226,7 +316,7 @@ mailing list. Please include "libc++" and "PATCH" in your subject.
@@ -287,44 +377,7 @@ End of search list.
-- You will need to keep the source tree of libc++abi - available on your build machine and your copy of the libc++abi shared library must - be placed where your linker will find it. -
- -- We can now run CMake: -
CC=clang CXX=clang++ cmake -G "Unix Makefiles"
- -DLIBCXX_CXX_ABI=libcxxabi
- -DLIBCXX_LIBCXXABI_INCLUDE_PATHS="<libc++abi-source-dir>/include"
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
- <libc++-source-dir>
make
sudo make install
- Unfortunately you can't simply run clang with "-stdlib=libc++" at this point, as - clang is set up to link for libc++ linked to libsupc++. To get around this - you'll have to set up your linker yourself (or patch clang). For example, -
clang++ -stdlib=libc++ helloworld.cpp -nodefaultlibs -lc++ -lc++abi -lm -lc -lgcc_s -lgcc
clang++ -stdlib=libc++ helloworld.cpp -lc++abi