I need to build Boost 1.62 and 1.63 on a Fedora 24 machine, but using GCC 4.9.3 or GCC 5.4.0 (depending on the version CUDA, which is the reason why I need an older compiler
The following solution was tested with Boost 1.62.0 + GCC 4.x, Boost 1.62.0 + GCC 5.x and Boost 1.65.1 + GCC 5.x. YMMV with other Boost versions but I see no reason why it shouldn't work.
Let's assume for the sake of this example that:
/some/where/g++-5.4
/path/to/sources/of/boost-1.62.0/
/dest/path
Now:
zlib
, bzip2
, lzma
, zstd
, iconv
, icu
)cd /path/to/sources/of/boost-1.62.0/
./bootstrap.sh
echo "using gcc : 5.4 : /the/path/to/g++-5.4 : <cxxflags>-std=c++11 ;" > ./tools/build/src/user-config.jam
./b2 --toolset=gcc-5.4 -j N
(N being the number of cores on your system)./b2 install --prefix=/dest/path
Notes:
c++11
with c++1y
if you want GCC 5.4.0's (non-finalized) C++14 support. If you're using a different GCC version, remember that before a standard is finalized you don't actually get its switch available. Thus C++11 used to mean --std=c++1x
and C++17 was --std=c++1z
and the switches change as GCC versions get released after standard finalization.I'm having the same issue.
It seems that, because you are cross-compiling, the boost building system is trying to check if your compiler supports all of those c++11 features.
The thing is, in order to do that, the build system compiles a sheet of code.
One of those files is this: boost_1_62_0/libs/rational/test/constexpr_test.cpp
Then, the build system does what no one would think when using a cross-compiler... it tries to execute the resultant binary on the host computer... It obviously fails. That is happening for all of those cxx11_ tests. I'm also having that issue and it is a problem. Because of this, I'm unable to build Boost.Fiber for my Raspberries with OpenWRT.