我有一个干净的 Boost Git 克隆,带有标签
boost-1.87.0
签出,并且所有子模块都被递归克隆。如果我根据各种入门指南和最佳实践文档先调用 bootstrap.sh
,然后再调用 b2
,那么我可以毫无问题地引导并构建 Boost。一切正常。
==开始编辑==
我创建了一个示例程序,可以以最小的努力复制问题。完整的解释仍在这篇文章中,但您可以在此处克隆并运行示例:https://github.com/beamerblvd/unable-find-target-with-boost-bcp。
==编辑结束==
无论它的价值如何(但我不相信这是我的问题),我使用的是带有 Clang 16 的 macOS 15,这些是我的
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
但是在我的情况下,仅仅构建 Stock Boost 是不够的,并且由于我无法控制且必须遵守的原因,我需要使用
bcp
自定义 Boost 命名空间。
所以这就是我正在做的:
{dir}/user-config.jam
:
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 ;
中间三行是我的 BCP 尝试所独有的;我在构建非 BCP Boost 时成功使用的第一行和最后一行。{dir}/_src/boostrap.sh
的 CWD 运行 {dir}/_src
(成功)。b2
,除了 variant=release
代替 variant=debug
,加上 --prefix={dir}/bcp --build-dir={dir}/bcp --stagedir={dir}/bcp/stage tools/bcp
,CWD 为 {dir}/_src
(成功)。{dir}/shobj/bin/bcp --namespace=boost_MYextralLabel --namespace-alias Jamroot boost boost-build.jam boostcpp.jam bootstrap.bat bootstrap.sh build status tools [insert_name_of_every_dir_in_libs] {dir}/_dst
的 CWD 运行 {dir}/_src
,将 {dir}/_src
的内容复制/变形为 {dir}/_dst
(成功)。{dir}/_dst/boostrap.sh
的 CWD 运行 {dir}/_dst
(成功)。b2
,除了 _src
替换为 _dst
,CWD 为 {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 : 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
在过去的两个工作日里,我尝试了数十种不同的方法,但总是得到完全相同的结果。我所做的唯一导致任何不同(但仍然错误的输出)的事情是,在步骤 4(运行
bcp
)和步骤 5(第二个引导程序,在新目录中)之间,通过删除“清理”生成的文件目录{dir}/_dst/boost
。如果我在 4 和 5 之间插入该步骤,则步骤 6 的错误输出现在是(进一步了解之后):
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
我确信我做错了什么,但经过 12 个多小时的工作,我已经没有想法了,并开始怀疑
bcp
坏了。
有什么想法吗?