Page MenuHomePhabricator

boost does not compile with gcc 4.9.2
Closed, ResolvedPublic

Description

I get this error when building Boost 1.56.0 with a Boost.cmake based on yours.

error: duplicate initialization of gcc with the following parameters:
error: version = 4.9.2
error: previous initialization at project-config.jam:12

I found the solution on this page:

https://forum.safenetwork.io/t/build-on-arch-x64-fails/2209/2

It worked for me. You will likely need the same fix as well.

The gcc 4.9.2 came with the devtools3 package on RHEL6.

Event Timeline

Thank you, Miklos. What was the fix that worked for you? - The extension of the regex or the installation of missing package?

User kislinsk has pushed new remote branch:

bug-19258-FixBoostBuild

Sorry, this fixes the boost configuration on RHEL 6 with devtoolset-3, but breaks it on Ubuntu 14.04.

I do not know what would work on both platforms. :-(

This is the error if the regex contains the optional patch number:

error: toolset gcc initialization:
error: version '4.8.4' requested but 'g++-4.8.4' not found and version '4.8' of default 'g++' does not match
error: initialized from
/home/espakm/src/niftymidas-2015-debug/Boost/src/tools/build/src/build/toolset.jam:43: in toolset.using from module toolset
/home/espakm/src/niftymidas-2015-debug/Boost/src/tools/build/src/build-system.jam:461: in process-explicit-toolset-requests from module build-system
/home/espakm/src/niftymidas-2015-debug/Boost/src/tools/build/src/build-system.jam:527: in load from module build-system
/home/espakm/src/niftymidas-2015-debug/Boost/src/tools/build/src/kernel/modules.jam:289: in import from module modules
/home/espakm/src/niftymidas-2015-debug/Boost/src/tools/build/src/kernel/bootstrap.jam:139: in boost-build from module
/home/espakm/src/niftymidas-2015-debug/Boost/src/boost-build.jam:17: in module scope from module

Okay, then we have to figure out how we can reliably distinguish between distributions that need the fix and those which don't.

Matt came up with this fix that works for us:

get_filename_component(_cxx_compiler_name "${CMAKE_CXX_COMPILER}" NAME)
string(REGEX MATCH "^[0-9]+\\.[0-9]+" _compiler_version "${CMAKE_CXX_COMPILER_VERSION}")
if(_cxx_compiler_name MATCHES "${_compiler_version}")
  set(_boost_toolset "${_boost_with_toolset}-${_compiler_version}")
endif()

User kolbch has pushed new remote branch:

bug-19258-FixBoostBuild2

I successfully tested this fix with gcc 6.1.1 and gcc 5.3.1, so it seems good to me. Can we merge this?

After you merged be prepared that this might not be the last change on these lines as it seems a bit random/fragile. :) We still have DCs with GCC 4.x, right?

[9f680a]: Merge branch 'bug-19258-FixBoostBuild2'

Merged commits:

2016-05-19 11:41:13 Christoph Kolb [d2a265]
fix for some gcc compiler versions that do not match the regex