Building libc++ on Linux

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
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

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
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/os_defines.h
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cpu_defines.h
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cxxabi_tweaks.h
/usr/local/include/bits
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.

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
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/os_defines.h
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cpu_defines.h
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cxxabi_tweaks.h
/usr/local/include/bits
sudo cp /usr/include/c++/4.6/bits/cxxabi_forced.h /usr/local/include/bits

I had to tweak this work-around a bit for Debian Squeeze with GCC 4.4.
(Aside from changing 4.6 to 4.4, of course.)

Namely, “cxxabi_forced.h” is spelled with a dash instead of an underscore,
aka “cxxabi-forced.h” and resides in the toplevel include directory.
With that change, the last line looks like this for me:

sudo cp /usr/include/c++/4.4/cxxabi-forced.h /usr/local/include

And libc++ compiles fine again. Thanks! :slight_smile:

Xeo