Boost logo

Boost Users :

Subject: [Boost-users] How to compile boost with non-standard clang installations.
From: Bill White (bill.white_at_[hidden])
Date: 2014-02-10 18:29:05

I am trying to build boost using clang. I know there are many sources of
advice for doing this, but I can't seem to find a description of my exact
system, and my attempts to adapt them have not been notably successful.

Here are my configuration constraints:
1.) Clang is not the system compiler. It is compiled in installed in
    with prefix $a/clang. So, $a/clang/bin/clang++ is the C++
compiler, and so forth.
    I am using the tip of the llvm/clang tree.
2.) I want to use libc++, which is installed in
$a/clang/lib/ I also want
    to use the libc++ abi, which is installed in $a/clang/lib/
3.) The libc++ standard library include files are installed in

For most programs I compile with the options
  -nostdinc++ -isystem $a/clang/include/c++/v1 -std=c++11
and link with
  -stdlib=libc++ -L$a/clang/lib -lcxxabi

This seems to work pretty well for most circumstances. However, I
can't figure out
how to translate this to boost 1.55.0. I tried:
  ./ --with-toolset=clang --prefix=$a/clang
  ./b2 toolset=clang \
        cxxflags="-std=c++11 -nostdinc++ -isystem
$a/clang/include/c++/v1 -stdlib=libc++" \
        linkflags="-stdlib=c++ -L$a/clang/lib" \
        --prefix=$a/clang -j10 define=BOOST_SYSTEM_NO_DEPRECATED stage release

However, the compilations failed. They all seemed to fail compiling
type_traits. A typical
failure is:

In file included from libs/regex/build/../src/icu.cpp:20:
In file included from ./boost/regex/config.hpp:43:
In file included from ./boost/config.hpp:40:
In file included from ./boost/config/select_stdlib_config.hpp:37:
In file included from ./boost/config/no_tr1/utility.hpp:21:
In file included from
In file included from /local/billw/arch/glnxa64/clang/include/c++/v1/__tuple:16:
error: expected expression
    static const bool value = decltype(__test<_Tp>(nullptr))::value;
1 error generated.

  "clang++" -c -x c++ -std=c++11 -nostdinc++ -isystem
/local/billw/arch/glnxa64/clang/include/c++/v1 -O3 -finline-functions
-Wno-inline -Wall -pedantic -pthread -fPIC -std=c++11 -nostdinc++
-isystem /local/billw/arch/glnxa64/clang/include/c++/v1

...failed clang-linux.compile.c++.without-pth

(Here $a is /local/billw/arch/glnxa64.)

I apologize for the length of this, but I didn't know what to leave out.

Thanks in advance.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at