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
separately,
    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/libc++.so. I also want
    to use the libc++ abi, which is installed in $a/clang/lib/libcxxabi.so.
3.) The libc++ standard library include files are installed in
$a/include/c++/v1.

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:
  ./bootstrap.sh --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:

clang-linux.compile.c++.without-pth
bin.v2/libs/regex/build/clang-linux-3.0/release/threading-multi/icu.o
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
/local/billw/arch/glnxa64/clang/include/c++/v1/utility:157:
In file included from /local/billw/arch/glnxa64/clang/include/c++/v1/__tuple:16:
/local/billw/arch/glnxa64/clang/include/c++/v1/type_traits:3308:31:
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
-DBOOST_ALL_NO_LIB=1 -DBOOST_REGEX_DYN_LINK=1
-DBOOST_SYSTEM_NO_DEPRECATED -DNDEBUG -I"." -o
"bin.v2/libs/regex/build/clang-linux-3.0/release/threading-multi/icu.o"
"libs/regex/build/../src/icu.cpp"

...failed clang-linux.compile.c++.without-pth
bin.v2/libs/regex/build/clang-linux-3.0/release/threading-multi/icu.o...

(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 hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net