Boost build cannot check C ++ 11 when using (custom) GCC 4.x or 5.x

I need to create 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 CUDA version, which is the reason that I need an older compiler). But if I configure the custom version of GCC as described in this answer and run

/b2 --toolset=gcc-5.4.0 stage 

To my chagrin, now I see:

  - 32-bit : no - 64-bit : yes - arm : no - mips1 : no - power : no - sparc : no - x86 : yes - symlinks supported : yes - C++11 mutex : no - lockfree boost::atomic_flag : yes - Boost.Config Feature Check: cxx11_auto_declarations : no - Boost.Config Feature Check: cxx11_constexpr : no - Boost.Config Feature Check: cxx11_defaulted_functions : no - Boost.Config Feature Check: cxx11_final : yes - Boost.Config Feature Check: cxx11_hdr_tuple : no - Boost.Config Feature Check: cxx11_lambdas : no - Boost.Config Feature Check: cxx11_noexcept : no - Boost.Config Feature Check: cxx11_nullptr : no - Boost.Config Feature Check: cxx11_rvalue_references : no - Boost.Config Feature Check: cxx11_template_aliases : no - Boost.Config Feature Check: cxx11_thread_local : no - Boost.Config Feature Check: cxx11_variadic_templates : yes 

i.e. many C ++ 11 features are supposedly missing, but they shouldn't be. This does not happen when it is created using the GCC version for distribution (6.2.1).

Why is this happening and what do I need to do to create Boost to find out my features in GCC 5.4.0 (or 4.9.3)?

+8
c ++ gcc boost c ++ 11 b2
source share
2 answers

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 versions of Boost, but I see no reason why this should not work.

Assume for this example that:

  • Do you want to create Boost with GCC 5.4
  • The g ++ 5.4 binary number is in /some/where/g++-5.4
  • You downloaded Boost sources and unpacked them in /path/to/sources/of/boost-1.62.0/
  • (Maybe) you want to set Boost to /dest/path
  • You have N cores (so you want to parallelize N-build paths)

Now:

  1. cd/path/to/sources/of/boost-1.62.0/
  2. Booststrap build system by running ./bootstrap.sh
  3. echo "using gcc: 5.4 : /the/path/to/g++-5.4: <cxxflags>-std=c++11 ;" >./tools/build/src/user-config.jam
  4. ./b2 --toolset=gcc-5.4 -j N (N is the number of cores in your system)
  5. ./b2 install --prefix=/dest/path

Notes:

  • Procedure 2 and 3 does not matter.
  • You can replace c++11 with c++1y if you want support for GCC 5.4.0 (not complete) C ++ 14. If you are using a different version of GCC, remember that before the standard is completed, you don't actually get access to his switch. So C ++ 11 meant --std=c++1x and C ++ 17 had --std=c++1z and the switches change as GCC releases after standard finalization.
+7
source share

I have the same problem.

It seems that since you are doing cross-compilation, the level-up system tries to check if your compiler supports all these C ++ 11 functions. The fact is that for this the build system compiles a code sheet. One of these files: boost_1_62_0/libs/rational/test/constexpr_test.cpp

Then the build system does what no one would think about using the cross-compiler ... it tries to execute the resulting binary on the host computer ... Obviously, it does not work. This happens for all of these cxx11_ tests. I also have this problem and this is the problem. Because of this, I cannot build Boost.Fiber for my raspberries with OpenWRT.

+7
source share

All Articles