"error: Unable to find file or target named" when using BCP to change Boost namespace

Background: My organization uses Boost internally for one of its software products, which is itself a C++ library. Users of our library also often use Boost. As such, we must compile our Boost in a different namespace so that the Boost symbols loaded when our library loads do not interfere with whatever different-version Boost symbols our users might load. Historically, another member of the team has been responsible for building new versions of Boost, but now it's me. I am doing this the same way our code/documentation has previously done it, but it is no longer working, and the errors I'm receiving are not familiar to the team member who was previously responsible for this. The last time we built a new Boost version was 1.80.0. I am now doing it with 1.87.0. The example: Further below, I include a lot of information and build commands, but that might not be useful to you. To help, I have created a minimal reproduction program for reproducing the error. You can clone and use it here: https://github.com/beamerblvd/unable-find-target-with-boost-bcp The good: With minimal effort and using our existing tools and configurations, I was easily able to bootstrap `b2` and then run `b2` to build stock Boost with the normal `boost` namespace. All of that worked perfectly and without error. The bad: When I went to do the same thing but with our custom namespace (via bcp), things fell apart. Our existing tooling copies the untouched 1.87.0 source tree into {dir}/_src. {dir}/user-config.jam is configured as follows: ``` 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 ; ``` Within {dir}/_src, I call `bootstrap.sh` and then build `bcp` with: bc -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 That takes a few minutes to complete and does so without error. Once `bcp` is built, I run it with: mkdir {dir}/_dst && \ {dir}/bcp/bin/bcp --boost={dir}/_src --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 That takes a few minutes to complete and does so without error. The contents of {dir}/_dst look as I would expect them to look, with diffs against {dir}/_src reflecting the change in namespace. Once complete, I cd into {dir}/_dst, re-bootstrap, and run `b2` to compile the modified Boost: b2 -sBOOST_ROOT={dir}/_dst \ --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 This fails quickly, here: ... - 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 I have tried dozens of different things over the past two days and can't remember most of them, but they didn't change the outcome, so I don't supposed they're relevant. The one thing that *did* change the outcome is that, after running `bcp` and before re-bootstrapping in {dir}/_dst, I tried deleting the {dir}/_dst/boost directory. This still failed, but it got slightly further and failed with a different (albeit extremely similar) error: ... - 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 I feel like I've exhausted my ability to discern what the problem is. Other than updating a handful of compiler flags (like changing cxxstd=17 to cxxstd=20), I'm doing this the same way we have (allegedly) always done it, but it's not working anymore and I don't know why. I would appreciate any guidance you can offer. Thank you, Nick

чт, 16 янв. 2025 г. в 18:09, Nicholas Williams via Boost-users <boost-users@lists.boost.org>:
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
That is a bug in bcp. If you're looking for a quick fix, find this line in Jamroot: modules.poke $(lib-module) : BOOST_LIB_TARGET : boost_$(lib) ; And replace it with modules.poke $(lib-module) : BOOST_LIB_TARGET : "boost"_$(lib) ; Then run bcp again.

This got me further, but it ultimately still failed later in the config with a similar error: ... - std_wstreambuf builds : yes [2] - std_wstreambuf : yes [2] - BOOST_COMP_GNUC >= 4.3.0 : no [2] - BOOST_COMP_GNUC >= 4.3.0 : no [3] error: Unable to find file or target named error: 'libs/thread/build//boost_MYextralLabel_thread' error: referred to from project at error: '.' Notable differences in this error message are that now the target it's unable to find contains my custom namespace, and now the project referring to it is '.' instead of a path to subdirectory. Also notable that this new error is the same error I previously received if I deleted the 'boost' output directory after running `bcp` but before running `bootstrap`. So it seems that your suggested past gets past one bug but reveals the next bug. Thanks, Nick On Thu, Jan 16, 2025 at 1:01 PM Дмитрий Архипов via Boost-users < boost-users@lists.boost.org> wrote:
чт, 16 янв. 2025 г. в 18:09, Nicholas Williams via Boost-users <boost-users@lists.boost.org>:
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
That is a bug in bcp. If you're looking for a quick fix, find this line in Jamroot:
modules.poke $(lib-module) : BOOST_LIB_TARGET : boost_$(lib) ;
And replace it with
modules.poke $(lib-module) : BOOST_LIB_TARGET : "boost"_$(lib) ;
Then run bcp again. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users

This helped me a lot, however. I was able to expand on your suggested patch. Everything works perfectly if I patch Jamroot as follows before running bcp: --- boost/Jamroot 2025-01-12 12:14:52 +++ boost/Jamroot.new 2025-01-16 15:09:03 @@ -305,24 +305,24 @@ # First, the complicated libraries: where the target name in Jamfile is # different from its directory name. explicit - [ alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ] - [ alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ] - [ alias unit_test_framework : libs/test/build//boost_unit_test_framework ] - [ alias serialization : libs/serialization/build//boost_serialization ] - [ alias wserialization : libs/serialization/build//boost_wserialization ] + [ alias prg_exec_monitor : libs/test/build//"boost"_prg_exec_monitor ] + [ alias test_exec_monitor : libs/test/build//"boost"_test_exec_monitor ] + [ alias unit_test_framework : libs/test/build//"boost"_unit_test_framework ] + [ alias serialization : libs/serialization/build//"boost"_serialization ] + [ alias wserialization : libs/serialization/build//"boost"_wserialization ] ; for local l in $(all-libraries-to-build) { if ! $(l) in test graph serialization headers { - explicit [ alias $(l) : libs/$(l)/build//boost_$(l) ] ; + explicit [ alias $(l) : libs/$(l)/build//"boost"_$(l) ] ; } } for local l in $(all-libraries-modular-build) { if ! $(l) in test graph serialization headers { - explicit [ alias $(l) : /boost/$(l)//boost_$(l) ] ; + explicit [ alias $(l) : /boost/$(l)//"boost"_$(l) ] ; } } @@ -449,7 +449,7 @@ local lib-module = [ project.load $(lib-path) : synthesize ] ; modules.poke $(lib-module) : BOOST_LIB_PROJECT : /boost/$(lib) ; - modules.poke $(lib-module) : BOOST_LIB_TARGET : boost_$(lib) ; + modules.poke $(lib-module) : BOOST_LIB_TARGET : "boost"_$(lib) ; project.push-current [ project.target $(lib-module) ] ; module $(lib-module) { On Thu, Jan 16, 2025 at 2:46 PM Nicholas Williams < nicholas@nicholaswilliams.net> wrote:
This got me further, but it ultimately still failed later in the config with a similar error:
... - std_wstreambuf builds : yes [2] - std_wstreambuf : yes [2] - BOOST_COMP_GNUC >= 4.3.0 : no [2] - BOOST_COMP_GNUC >= 4.3.0 : no [3] error: Unable to find file or target named error: 'libs/thread/build//boost_MYextralLabel_thread' error: referred to from project at error: '.'
Notable differences in this error message are that now the target it's unable to find contains my custom namespace, and now the project referring to it is '.' instead of a path to subdirectory.
Also notable that this new error is the same error I previously received if I deleted the 'boost' output directory after running `bcp` but before running `bootstrap`. So it seems that your suggested past gets past one bug but reveals the next bug.
Thanks,
Nick
On Thu, Jan 16, 2025 at 1:01 PM Дмитрий Архипов via Boost-users < boost-users@lists.boost.org> wrote:
чт, 16 янв. 2025 г. в 18:09, Nicholas Williams via Boost-users <boost-users@lists.boost.org>:
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
That is a bug in bcp. If you're looking for a quick fix, find this line in Jamroot:
modules.poke $(lib-module) : BOOST_LIB_TARGET : boost_$(lib) ;
And replace it with
modules.poke $(lib-module) : BOOST_LIB_TARGET : "boost"_$(lib) ;
Then run bcp again. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users

The one thing that is still not right after getting BCP working with the patch in the previous email is the .so/.dylib/.dll file names. Previously, they came out looking like this: libboost_MYextralLabel_chrono-macos15-clang16-arm-d.dylib Now they look like this: libboost_chrono-macos15-clang16-arm-d.dylib Did the changes we made to Jamroot cause this? Or is there something somewhere else that needs a patch? It seems we need the file names to be correct (the way they were before). Thanks, Nick On Thu, Jan 16, 2025 at 7:44 PM Nicholas Williams < nicholas@nicholaswilliams.net> wrote:
This helped me a lot, however. I was able to expand on your suggested patch. Everything works perfectly if I patch Jamroot as follows before running bcp:
--- boost/Jamroot 2025-01-12 12:14:52 +++ boost/Jamroot.new 2025-01-16 15:09:03 @@ -305,24 +305,24 @@ # First, the complicated libraries: where the target name in Jamfile is # different from its directory name. explicit - [ alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ] - [ alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ] - [ alias unit_test_framework : libs/test/build//boost_unit_test_framework ] - [ alias serialization : libs/serialization/build//boost_serialization ] - [ alias wserialization : libs/serialization/build//boost_wserialization ] + [ alias prg_exec_monitor : libs/test/build//"boost"_prg_exec_monitor ] + [ alias test_exec_monitor : libs/test/build//"boost"_test_exec_monitor ] + [ alias unit_test_framework : libs/test/build//"boost"_unit_test_framework ] + [ alias serialization : libs/serialization/build//"boost"_serialization ] + [ alias wserialization : libs/serialization/build//"boost"_wserialization ] ; for local l in $(all-libraries-to-build) { if ! $(l) in test graph serialization headers { - explicit [ alias $(l) : libs/$(l)/build//boost_$(l) ] ; + explicit [ alias $(l) : libs/$(l)/build//"boost"_$(l) ] ; } } for local l in $(all-libraries-modular-build) { if ! $(l) in test graph serialization headers { - explicit [ alias $(l) : /boost/$(l)//boost_$(l) ] ; + explicit [ alias $(l) : /boost/$(l)//"boost"_$(l) ] ; } }
@@ -449,7 +449,7 @@ local lib-module = [ project.load $(lib-path) : synthesize ] ; modules.poke $(lib-module) : BOOST_LIB_PROJECT : /boost/$(lib) ; - modules.poke $(lib-module) : BOOST_LIB_TARGET : boost_$(lib) ; + modules.poke $(lib-module) : BOOST_LIB_TARGET : "boost"_$(lib) ; project.push-current [ project.target $(lib-module) ] ; module $(lib-module) {
On Thu, Jan 16, 2025 at 2:46 PM Nicholas Williams < nicholas@nicholaswilliams.net> wrote:
This got me further, but it ultimately still failed later in the config with a similar error:
... - std_wstreambuf builds : yes [2] - std_wstreambuf : yes [2] - BOOST_COMP_GNUC >= 4.3.0 : no [2] - BOOST_COMP_GNUC >= 4.3.0 : no [3] error: Unable to find file or target named error: 'libs/thread/build//boost_MYextralLabel_thread' error: referred to from project at error: '.'
Notable differences in this error message are that now the target it's unable to find contains my custom namespace, and now the project referring to it is '.' instead of a path to subdirectory.
Also notable that this new error is the same error I previously received if I deleted the 'boost' output directory after running `bcp` but before running `bootstrap`. So it seems that your suggested past gets past one bug but reveals the next bug.
Thanks,
Nick
On Thu, Jan 16, 2025 at 1:01 PM Дмитрий Архипов via Boost-users < boost-users@lists.boost.org> wrote:
чт, 16 янв. 2025 г. в 18:09, Nicholas Williams via Boost-users <boost-users@lists.boost.org>:
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
That is a bug in bcp. If you're looking for a quick fix, find this line in Jamroot:
modules.poke $(lib-module) : BOOST_LIB_TARGET : boost_$(lib) ;
And replace it with
modules.poke $(lib-module) : BOOST_LIB_TARGET : "boost"_$(lib) ;
Then run bcp again. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users

пт, 17 янв. 2025 г. в 05:42, Nicholas Williams via Boost-users <boost-users@lists.boost.org>:
The one thing that is still not right after getting BCP working with the patch in the previous email is the .so/.dylib/.dll file names. Previously, they came out looking like this:
libboost_MYextralLabel_chrono-macos15-clang16-arm-d.dylib
Now they look like this:
libboost_chrono-macos15-clang16-arm-d.dylib
Did the changes we made to Jamroot cause this? Or is there something somewhere else that needs a patch? It seems we need the file names to be correct (the way they were before).
No, this is the result of BCP not changing jamfiles where necessary. On second thought, my original "easy fix" wasn't really a fix at all. I've made a PR draft for BCP that (locally for me) fixes the problem. The PR is https://github.com/boostorg/bcp/pull/23. I don't know if it creates some other problems, though. Please, try and report any issues in the PR.

That pull request applied as a patch to my local checkout of 1.87.0 worked perfectly. No more configure/build errors and all of my libraries are named as expected now. Thanks! Nick On Fri, Jan 17, 2025 at 7:03 AM Дмитрий Архипов via Boost-users < boost-users@lists.boost.org> wrote:
пт, 17 янв. 2025 г. в 05:42, Nicholas Williams via Boost-users <boost-users@lists.boost.org>:
The one thing that is still not right after getting BCP working with the
patch in the previous email is the .so/.dylib/.dll file names. Previously, they came out looking like this:
libboost_MYextralLabel_chrono-macos15-clang16-arm-d.dylib
Now they look like this:
libboost_chrono-macos15-clang16-arm-d.dylib
Did the changes we made to Jamroot cause this? Or is there something
somewhere else that needs a patch? It seems we need the file names to be correct (the way they were before).
No, this is the result of BCP not changing jamfiles where necessary. On second thought, my original "easy fix" wasn't really a fix at all. I've made a PR draft for BCP that (locally for me) fixes the problem. The PR is https://github.com/boostorg/bcp/pull/23. I don't know if it creates some other problems, though. Please, try and report any issues in the PR. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Nicholas Williams
-
Дмитрий Архипов