Skip to content

cooking_recipe: Boost bootstrap fails when CMAKE_CXX_COMPILER has a version suffix (e.g. clang++-20) #3420

@travisdowns

Description

@travisdowns

When --cook Boost is used with a versioned compiler (e.g. --compiler clang++-20) and no unversioned clang++/g++ symlink exists on PATH, configure fails during Boost bootstrap:

> clang++ -x c++ -std=c++11  check_cxx11.cpp
./tools/build/src/engine/build.sh: 120: clang++: not found

Cause

cooking_recipe.cmake passes --with-toolset=clang (unversioned) to Boost's bootstrap.sh. bootstrap.sh hardcodes the binary name clang++/g++ for the C++11 capability check it runs while building the B2 engine, and it does not accept --cxx (the flag errors out as unrecognized) nor forward $CXX to build.sh — the relevant line in bootstrap.sh is CXX= CXXFLAGS= "$my_dir/tools/build/src/engine/build.sh" ${TOOLSET}, which scrubs both. The cook_boost.jam user-config the recipe writes does carry the full ${CMAKE_CXX_COMPILER} path, but it's only consumed by the later b2 install step, not by bootstrap.sh.

Verified the same bootstrap.sh shape exists in Boost 1.86 and current master, so this isn't fixed by upgrading Boost — it's a recipe-side gap.

Reproduce

./configure.py --cook fmt --cook GnuTLS --cook Boost --compiler clang++-20 --c++-standard=20

(any setup where the chosen compiler has no unversioned clang++/g++ peer on PATH).

Fix that works

Create a per-project shim directory (e.g. ${CMAKE_CURRENT_BINARY_DIR}/cook_boost_shim/) containing a clang++ or g++ symlink to ${CMAKE_CXX_COMPILER} and prepend it to PATH only for the bootstrap.sh invocation in the Boost ingredient's PATCH_COMMAND. The rest of the build is unaffected. Happy to send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions