[cfe-dev] Building libc++ on Linux

Jeffrey Yasskin jyasskin at gmail.com
Sat Feb 18 21:50:19 PST 2012

On Sat, Feb 18, 2012 at 9:19 PM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
> When building libc++ on a clean Linux system (through cmake), it
> complains that it can't find cxxabi.h. This is sensible because
> cxxabi.h lives at /usr/include/c++/4.6/cxxabi.h, right next to all the
> other C++ library headers, and the libc++ build passes -nostdinc++ to
> avoid accidentally including those.
> What's the right way to fix this? Options include:
> 1) Document that linux users should copy or symlink cxxabi.h from
> their c++ include directory into /usr/include

In practice, the commands to do this on Ubuntu 11.10 are:

sudo cp /usr/include/c++/4.6/cxxabi.h /usr/local/include/
sudo mkdir /usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/c++config.h
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/os_defines.h
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cpu_defines.h
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cxxabi_tweaks.h
sudo cp /usr/include/c++/4.6/bits/cxxabi_forced.h /usr/local/include/bits

The target directory could be /usr/include instead, in which case the
x86_64-linux-gnu files can go into /usr/include/x86_64-linux-gnu/bits.

> 2) Teach clang to find cxxabi.h in the C++ library directories even
> with -nostdinc++
> 3) Have the libc++ build process find cxxabi.h and copy it into the
> libc++ include directory as part of the build.
> 4) ???
> 5) Profit!
> Jeffrey

More information about the cfe-dev mailing list