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

Nicholas Williams via Boost-build <[email protected]> Wed, 15 Jan 2025 20:03:06 -0600
Newsgroups gmane.comp.lib.boost.build
Message-ID <CAGn4V3WZFcW_g01fUDZScK0djpL-5pLXL68fOuwDxY5dfNQCQg@mail.gmail.com>
--===============1370971949705730137==
Content-Type: multipart/alternative; boundary="000000000000a0af36062bc932bd"

--000000000000a0af36062bc932bd
Content-Type: text/plain; charset="UTF-8"

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

--000000000000a0af36062bc932bd
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Background: My organization uses Boost internally for one =
of its software products, which is itself a C++ library. Users of our libra=
ry 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 in=
terfere=C2=A0with whatever different-version Boost symbols our users might =
load. Historically, another member of the team has been responsible for bui=
lding new versions of Boost, but now it&#39;s me. I am doing this the same =
way our code/documentation has previously done it, but it is no longer work=
ing, and the errors I&#39;m receiving are not familiar to the team member w=
ho was previously responsible=C2=A0for this. The last time we built a new B=
oost version was 1.80.0. I am now doing it with 1.87.0.<div><br></div><div>=
The example: Further below, I include a lot of information and build comman=
ds, 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 he=
re:=C2=A0<a href=3D"https://github.com/beamerblvd/unable-find-target-with-b=
oost-bcp" target=3D"_blank">https://github.com/beamerblvd/unable-find-targe=
t-with-boost-bcp</a></div><div><div><br></div><div>The good: With minimal e=
ffort 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 `boo=
st` namespace. All of that worked perfectly and without error.</div><div><b=
r></div><div>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 unt=
ouched 1.87.0 source tree into {dir}/_src. {dir}/user-config.jam is configu=
red as follows:</div><div><br></div><div>```</div><div>constant BOOST_VERSI=
ON : mybranchname-1.87.0.a ;<br>constant MY_PLATFORM : macos15-clang16-arm-=
d ;<br>constant MY_LABEL : MYextralLabel ;<br>constant BOOST_USER_CONFIG : =
&lt;my_boost/config/user.hpp&gt; ;<br>using clang : 16 : clang++ : &lt;cxxf=
lags&gt;-fvisibility=3Dhidden &lt;cxxflags&gt;-fvisibility-inlines-hidden ;=
</div><div>```</div><div><br></div><div>Within {dir}/_src, I call `bootstra=
p.sh` and then build `bcp` with:</div><div><br></div><div>bc -sBOOST_ROOT=
=3D{dir}/_src \</div>=C2=A0 --boost-build=3Dtools/build/src \<br>=C2=A0 cxx=
std=3D20 \<br>=C2=A0 -d \<br>=C2=A0 2 \<br>=C2=A0 -j \<br>=C2=A0 2 \<br>=C2=
=A0 -q \<br>=C2=A0 --prefix=3D{dir}/bcp \<br>=C2=A0 --build-dir=3D{dir}/bcp=
 \<br>=C2=A0 --stagedir=3D{dir}/bcp/stage \<br>=C2=A0 --user-config=3D{dir}=
/user-config.jam \<br>=C2=A0 --layout=3Dsystem \<br>=C2=A0 toolset=3Dclang-=
darwin \<br>=C2=A0 threading=3Dmulti \<br>=C2=A0 link=3Dshared \<br>=C2=A0 =
architecture=3Darm \<br>=C2=A0 instruction-set=3Dnocona \<br>=C2=A0 address=
-model=3D64 \<br>=C2=A0 --without-python \<br>=C2=A0 --disable-icu \<br>=C2=
=A0 variant=3Drelease<div>=C2=A0 tools/bcp</div><div><br></div><div>That ta=
kes a few minutes to complete and does so without error. Once `bcp` is buil=
t, I run it with:</div><div><br></div><div>mkdir {dir}/_dst &amp;&amp; \</d=
iv><div>{dir}/bcp/bin/bcp=C2=A0--boost=3D{dir}/_src --namespace=3Dboost_MYe=
xtralLabel --namespace-alias Jamroot boost boost-build.jam boostcpp.jam boo=
tstrap.bat bootstrap.sh build status tools [insert_name_of_every_dir_in_lib=
s] {dir}/_dst</div><div><br></div><div>That takes a few minutes to complete=
 and does so without error. The contents of {dir}/_dst look as I would expe=
ct them to look, with diffs against {dir}/_src reflecting the change in nam=
espace. Once complete, I cd into {dir}/_dst, re-bootstrap, and run `b2` to =
compile the modified Boost:</div><div><br></div><div>b2 -sBOOST_ROOT=3D{dir=
}/_dst \</div>=C2=A0 --boost-build=3Dtools/build/src \<br>=C2=A0 cxxstd=3D2=
0 \<br>=C2=A0 -d \<br>=C2=A0 2 \<br>=C2=A0 -j \<br>=C2=A0 2 \<br>=C2=A0 -q =
\<br>=C2=A0 --prefix=3D{dir} \<br>=C2=A0 --build-dir=3D{dir}/shobj \<br>=C2=
=A0 --stagedir=3D{dir}/stage \<br>=C2=A0 --user-config=3D{dir}/user-config.=
jam \<br>=C2=A0 --layout=3Dsystem \<br>=C2=A0 toolset=3Dclang-darwin \<br>=
=C2=A0 threading=3Dmulti \<br>=C2=A0 link=3Dshared \<br>=C2=A0 architecture=
=3Darm \<br>=C2=A0 instruction-set=3Dnocona \<br>=C2=A0 address-model=3D64 =
\<br>=C2=A0 --without-python \<br>=C2=A0 --disable-icu \<br>=C2=A0 variant=
=3Ddebug<div><br></div><div>This fails quickly, here:</div><div><br></div><=
div>...</div><div>=C2=A0 =C2=A0 - native syslog supported =C2=A0: yes [2]<b=
r>=C2=A0 =C2=A0 - pthread supports robust mutexes : no [2]<br>=C2=A0 =C2=A0=
 - Boost.Regex is header-only : yes [2]<br>error: Unable to find file or ta=
rget named<br>error: =C2=A0 =C2=A0 &#39;/boost/align//boost_align&#39;<br>e=
rror: referred to from project at<br>error: =C2=A0 =C2=A0 &#39;{dir}/_dst/l=
ibs/atomic/build&#39;<br>make: *** [build] Error 1</div><div><br></div><div=
>I have tried dozens of different things over the past two days and can&#39=
;t remember most of them, but they didn&#39;t change the outcome,=C2=A0so I=
 don&#39;t supposed they&#39;re relevant. The one thing that *did* change t=
he 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:</div><div><br></div><div>...</div><div>=C2=A0 =C2=A0 - std_=
wstreambuf =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 : no [2]</div>=C2=A0 =C2=A0 -=
 std_wstreambuf =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 : no [3]<br>=C2=A0 =C2=
=A0 - BOOST_COMP_GNUC &gt;=3D 4.3.0 : no [2]<br>=C2=A0 =C2=A0 - BOOST_COMP_=
GNUC &gt;=3D 4.3.0 : no [4]<br>error: Unable to find file or target named<b=
r>error: =C2=A0 =C2=A0 &#39;libs/thread/build//boost_MYextralLabel_thread&#=
39;<br>error: referred to from project at<br>error: =C2=A0 =C2=A0 &#39;.&#3=
9;<br>make: *** [build] Error 1<div><br></div><div>I feel like I&#39;ve exh=
austed my ability to discern what the problem is. Other than updating a han=
dful of compiler flags (like changing cxxstd=3D17 to cxxstd=3D20), I&#39;m =
doing this the same way we have (allegedly) always done it, but it&#39;s no=
t working anymore and I don&#39;t know why.</div><div><br></div><div>I woul=
d appreciate any guidance you can offer.</div><div><br></div><div>Thank you=
,</div><div><br></div><div>Nick</div></div><div><br></div></div>

--000000000000a0af36062bc932bd--

--===============1370971949705730137==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build

--===============1370971949705730137==--