How to compile/link Boost with clang++/libc++?

boost, c++, clang, libc++

Solution

I didn't know how to do this either. But after poking around in here, the getting started, and trial and error:

$ ./bootstrap --with-toolset=clang
$ ./b2 clean
$ ./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"

You'll get lots of warnings. And the signals library will fail to build due to LWG 2059. But otherwise I think it works.

Problem

The answer to this question Why can't clang with libc++ in c++0x mode link this boost::program_options example? states "You need to rebuild boost using clang++ -stdlib=libc++." I'm using MacOS Lion with clang v3.0. How do I build Boost v1.48.0 using clang and link it with libc++? Update: I've created a user-config.jam file with the following: ``` using clang-darwin ``` ...which will build Boost with clang instead of gcc. How do I link with libc++ instead of libstdc++?

Original source

Related problems