From 5d82294f3f5b6204f2fe601f1e2349d806854d9e Mon Sep 17 00:00:00 2001 From: Sun Yuechi Date: Sat, 20 Jun 2026 10:53:51 +0800 Subject: [PATCH] cmake/boost: load context Jamfile before passing context-impl to b2 With WITH_ASAN, b2 runs as `b2 context-impl=ucontext headers stage` for the build step and `b2 context-impl=ucontext install` for the install step. The `context-impl` feature is declared in libs/context/build/Jamfile.v2, which neither the headers/stage nor the install targets load, so b2 aborts with: error: unknown feature "" Name the context project as a target in both commands so its Jamfile (and the feature) loads before the build request is expanded. This works around https://github.com/boostorg/context/issues/297, fixed upstream in https://github.com/boostorg/context/commit/12ac945158ae3c2373ec0c888899373218aa209f and first released in Boost 1.88; drop it once the bundled Boost is bumped to 1.88 or newer. Signed-off-by: Sun Yuechi --- cmake/modules/BuildBoost.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/modules/BuildBoost.cmake b/cmake/modules/BuildBoost.cmake index 4b80296f9df..d47e1eeb471 100644 --- a/cmake/modules/BuildBoost.cmake +++ b/cmake/modules/BuildBoost.cmake @@ -144,15 +144,23 @@ function(do_build_boost root_dir version) if(WITH_BOOST_VALGRIND) list(APPEND b2 valgrind=on) endif() + set(b2_targets headers stage) + set(b2_install_targets install) if(WITH_ASAN) list(APPEND b2 context-impl=ucontext) + # `context-impl` is declared in libs/context/build/Jamfile.v2; the headers/stage + # and install targets never load it, so b2 aborts with `unknown feature + # ""`. Name the context project as a target so its Jamfile loads + # the feature first. + list(PREPEND b2_targets libs/context/build) + list(PREPEND b2_install_targets libs/context/build) endif() set(build_command - ${b2} headers stage + ${b2} ${b2_targets} #"--buildid=ceph" # changes lib names--can omit for static ${boost_features}) set(install_command - ${b2} install) + ${b2} ${b2_install_targets}) if(EXISTS "${PROJECT_SOURCE_DIR}/src/boost/bootstrap.sh") check_boost_version("${PROJECT_SOURCE_DIR}/src/boost" ${version}) set(source_dir -- 2.47.3