]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake/boost: load context Jamfile before passing context-impl to b2 69611/head
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Sat, 20 Jun 2026 02:53:51 +0000 (10:53 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Sat, 20 Jun 2026 07:41:11 +0000 (15:41 +0800)
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 "<context-impl>"

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 <sunyuechi@iscas.ac.cn>
cmake/modules/BuildBoost.cmake

index 4b80296f9dff8d60ae2948331bb6b1f47b99ec9d..d47e1eeb471796b7a48ee576af2628d181936d50 100644 (file)
@@ -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
+    # "<context-impl>"`. 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