You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用bcp修改Boost命名空间时出现找不到文件/目标的错误求助

自定义Boost命名空间后b2构建失败

环境与基础构建验证

  • 已克隆带boost-1.87.0标签的Boost仓库,递归拉取所有子模块
  • 按官方指南执行bootstrap.sh和b2可正常构建,无任何问题
  • 运行环境:macOS 15 + Clang 16
  • 常规b2构建参数:
-sBOOST_ROOT={dir}/_src \
--boost-build=tools/build/src \
cxxstd=20 \
-d 2 \
-j 2 \
-q \
--prefix={dir} \
--build-dir={dir}/shobj \
--stagedir={dir}/stage \
--user-config={dir}/user-config.jam \
--layout=system \
toolset=clang-darwin \
threading=multi \
link=shared \
architecture=arm \
instruction-set=nocona \
address-model=64 \
--without-python \
--disable-icu \
variant=debug

bcp自定义命名空间操作步骤

  1. 编写{dir}/user-config.jam(其中中间3行为bcp专属配置,其余2行已在常规构建中验证可用):
constant BOOST_VERSION : mybranchname-1.87.0.a ;
constant MY_PLATFORM : macos15-clang16-arm-d ;
constant MY_LABEL : MYextralLabel ;
constant BOOST_USER_CONFIG : <my_boost/config/user.hpp> ;
using clang : 16 : clang++ : <cxxflags>-fvisibility=hidden <cxxflags>-fvisibility-inlines-hidden ;
  1. 在{dir}/_src目录执行{dir}/_src/bootstrap.sh,执行成功
  2. 在{dir}/_src目录执行b2构建bcp工具,执行成功:
-sBOOST_ROOT={dir}/_src \
--boost-build=tools/build/src \
cxxstd=20 \
-d 2 \
-j 2 \
-q \
--prefix={dir}/bcp \
--build-dir={dir}/bcp \
--stagedir={dir}/bcp/stage \
--user-config={dir}/user-config.jam \
--layout=system \
toolset=clang-darwin \
threading=multi \
link=shared \
architecture=arm \
instruction-set=nocona \
address-model=64 \
--without-python \
--disable-icu \
variant=release \
tools/bcp
  1. 在{dir}/_src目录执行bcp复制并修改命名空间到{dir}/_dst,执行成功:
{dir}/shobj/bin/bcp --namespace=boost_MYextralLabel --namespace-alias Jamroot boost boost-build.jam boostcpp.jam bootstrap.bat bootstrap.sh build status tools [libs下所有目录名] {dir}/_dst
  1. 在{dir}/_dst目录执行{dir}/_dst/bootstrap.sh,执行成功
  2. 在{dir}/_dst目录执行b2构建修改后的Boost(将参数中的_src替换为_dst),构建失败

错误信息

常规操作后的错误

Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : arm [1]

Building the Boost C++ Libraries.


    - symlinks supported       : yes
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam.
note: to suppress this message, pass "--without-graph_parallel" to bjam.
    - icu                      : no [2]
    - iconv (libc)             : no [2]
    - iconv (separate)         : yes [2]
    - cxx11_auto_declarations  : yes [2]
    - cxx11_decltype           : yes [2]
    - cxx11_defaulted_functions : yes [2]
    - cxx11_defaulted_moves    : yes [2]
    - cxx11_hdr_functional     : yes [2]
    - cxx11_hdr_type_traits    : yes [2]
    - cxx11_noexcept           : yes [2]
    - cxx11_nullptr            : yes [2]
    - cxx11_override           : yes [2]
    - cxx11_range_based_for    : yes [2]
    - cxx11_rvalue_references  : yes [2]
    - cxx11_scoped_enums       : yes [2]
    - cxx11_smart_ptr          : yes [2]
    - cxx11_static_assert      : yes [2]
    - cxx11_variadic_templates : yes [2]
    - native atomic int32 supported : no [2]
    - native syslog supported  : yes [2]
    - pthread supports robust mutexes : no [2]
    - Boost.Regex is header-only : yes [2]
error: Unable to find file or target named
error:     '/boost/align//boost_align'
error: referred to from project at
error:     '{dir}/_dst/libs/atomic/build'
make: *** [build] Error 1

删除{dir}/_dst/boost目录后的错误

Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : arm [1]

Building the Boost C++ Libraries.


    - symlinks supported       : yes
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam.
note: to suppress this message, pass "--without-graph_parallel" to bjam.
    - icu                      : no [2]
    - iconv (libc)             : no [2]
    - iconv (separate)         : yes [2]
    - cxx11_auto_declarations  : no [2]
    - icu                      : no [3]
    - iconv (libc)             : no [3]
    - iconv (separate)         : yes [3]
    - cxx11_auto_declarations  : no [3]
    - native atomic int32 supported : no [2]
    - native syslog supported  : yes [2]
    - pthread supports robust mutexes : no [2]
    - Boost.Regex is header-only : no [2]
    - cxx11_static_assert      : no [2]
    - cxx11_static_assert      : no [3]
    - has std::atomic_ref      : no [2]
    - has -Wl,--no-undefined   : no [2]
    - has -Wl,-undefined,error : yes [2]
    - has statx                : no [2]
    - has statx syscall        : no [2]
    - cxx11_rvalue_references  : no [2]
    - has std::atomic_ref      : no [3]
    - has -Wl,--no-undefined   : no [3]
    - has -Wl,-undefined,error : yes [3]
    - has statx                : no [3]
    - has statx syscall        : no [3]
    - cxx11_rvalue_references  : no [3]
    - has_icu builds           : no [2]
    - lockfree boost::atomic_flag : no [2]
    - native atomic int32 supported : no [3]
    - native syslog supported  : yes [3]
    - pthread supports robust mutexes : no [3]
    - cxx11_lambdas            : no [2]
    - cxx11_lambdas            : no [3]
    - std_wstreambuf builds    : no [2]
    - std_wstreambuf           : no [2]
    - std_wstreambuf           : no [3]
    - BOOST_COMP_GNUC >= 4.3.0 : no [2]
    - BOOST_COMP_GNUC >= 4.3.0 : no [4]
error: Unable to find file or target named
error:     'libs/thread/build//boost_MYextralLabel_thread'
error: referred to from project at
error:     '.'
make: *** [build] Error 1

求助

已尝试数十种调整,结果一致。怀疑操作有误或bcp存在问题,求解决思路。

内容的提问来源于stack exchange,提问作者Nick Williams

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 00:15:55