3

I am trying to use the bcp tool in Boost to extract a subset of headers/libraries to use in my project.

  • OS: Linux Ubuntu 12.04 LTS x64
  • Boost version: 1.56.0, downloaded as source code from boost.org

I want to use a custom namespace as well, which bcp supplied, but the resulting code needs to be built, and this is not as straightforward as it should be.

I would have thought a simple

./dist/bin/bcp --namespace=myboost build filesystem ../myboost

would be enough to produce a set of files that could build the 'filesystem' library, but there seems to be extra problems that just keep cropping up.

I have read as many related posts all over the web that I could find, and yet none have presented a solution that works.

Steps I've followed and the corresponding error messages are detailed below.


After extracting the boost 1.56.0 tarball, I have done the following:

./bootstrap.sh
./b2 tools/bcp
mkdir ../myboost
./dist/bin/bcp --namespace=myboost build filesystem ../myboost

The files copied into ../myboost don't include a bootstrap.sh, b2, bjam or other *.jam files, which seem to be something the 'build' target should be including, right?

Other sources (including stackoverflow posts) have suggested copying these files from the original boost location:

cp bootstrap.sh boost-build.jam boostcpp.jam ../myboost
cd ../myboost
./bootstrap.sh

This then builds b2 and bjam ok.

When running b2, things fall over:

./b2

/work/approved-osslibs/boost/boost-1.56.0/myboost/tools/build/src/build /project.jam:262: in find-jamfile from module project
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory 'tools/inspect/build'.
error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
<error backtrace lines snipped>

So this implies to me that the 'build' tool relies on 'inspect', so we go back and copy that:

cd ../boost_1_56_0
./dist/bin/bcp --namespace=myboost inspect ../myboost
cd ../myboost
./b2

which results in the error:

/work/myboost/tools/build/src/build/project.jam:262: in find-jamfile from module project
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory 'libs/wave/tool/build'.
error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
<error backtrace lines snipped>

So that means 'build' also depends on wave...

cd ../boost_1_56_0
./dist/bin/bcp --namespace=myboost wave ../myboost
cd ../myboost
./b2

At which point I encounter this error:

/work/myboost/tools/build/src/build/targets.jam:397: in find-really
*** argument error
* rule project.is-registered-id ( id )
* called with: (  )
* missing argument id
/work/myboost/tools/build/src/build/project.jam:600:see definition of rule 'project.is-registered-id' being called
<error backtrace lines snipped>

I have found this particular error relating to the boost filesystem library referenced in this ticket but that was supposed to have been fixed so I wasn't expecting to see it in Boost 1.56.0 which is the latest release.

What is going on?

Why can't bcp create an executable build system for just one boost library?

Why is build dependent on inspect and wave, which add a LOT more headers to the extracted "myboost" than should be necessary?

Any help on this issue would be appreciated.

3
  • This appears to be a problem only with Boost 1.56.0 Using Boost 1.55.0 "bcp build filesystem ../myboost" produces all the necessary files in myboost and manages to build OK.
    – Danny S
    Oct 8, 2014 at 5:13
  • I went through this same whack-a-mole game recently. I found I had to manually add the libs chrono, inspect, system and wave to get it to work. I can only guess that the current version of bcp isn't so good at picking up transitive dependencies among Boost components. Anyway, adding those other two libs (just like you did with wave and inspect) was enough to make it work for me.
    – evadeflow
    Feb 25, 2015 at 19:44
  • I spoke too soon. Turns out I also had to do a cp -a $BOOST_ROOT/boost/atomic $TARGET_DIR/boost to get everything to compile. I don't know if it's just that I'm Doing It Wrong™, but this is pretty typical of my experience with bcp: it never gets the dependencies quite right, so you always have to do some manual copying to bring over missing headers, or invoke it a second time with an explicit list of libs it missed. Still a hella useful tool!
    – evadeflow
    Feb 26, 2015 at 13:32

1 Answer 1

0

I encountered a number of issues when trying to do this today with Boost 1.64 (which I compiled with MSVC 2010 under MS Windows). Thanks for pointing me in the right direction, BTW.

  • Start with bootstrap.bat and b2 -j 8 tools\bcp in the original Boost directory. (Here, as well as below, replace 8 with the number of simultaneous jobs to run.)
  • When running .\dist\bin\bcp, I found that I had to include tools\build\src and libs\config\checks\architecture on my command line, for later builds to work.
  • I also had to copy bootstrap.bat, boost-build.jam, and boostcpp.jam to my copied-boost directory.
  • I don't know why, but I had to rename my original Boost directory (i.e. the one that bcp was run from) or else the build would somehow end up back in there.

After that, changing to my copied-boost directory and running bootstrap.bat allowed me to build my cut-down version of Boost with the top-level namespace changed.

b2 -j 8 toolset=msvc-10.0 threading=multi link=shared address-model=32 variant=debug

b2 -j 8 toolset=msvc-10.0 threading=multi link=shared address-model=32 variant=release

move stage\lib lib32-msvc-10.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.