How can I use BCP to retrieve a subset of Boost that can be built?
I am trying to use the bcp tool in Boost to fetch a subset of headers / libraries for use in my project.
- OS: Linux Ubuntu 12.04 LTS x64
- Boost version: 1.56.0, download as source from boost.org
I also want to use my own namespace provided by bcp, but the resulting code needs to be built and it is not as easy as it should be.
I would think about a simple
./dist/bin/bcp --namespace=myboost build filesystem ../myboost
it would be enough to create a set of files that could create a "filesystem" library, but there seem to be additional problems that just keep popping up.
I've read as many related posts all over the net that I could find and yet no one has provided a solution that works.
The steps I followed and the corresponding error messages are detailed below.
After extracting the tar6.56.0 tarball, I did the following:
./bootstrap.sh
./b2 tools/bcp
mkdir ../myboost
./dist/bin/bcp --namespace=myboost build filesystem ../myboost
The files copied to .. / myboost do not contain bootstrap.sh, b2, bjam or other * .jam files that seem to include the "build" target, 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
Then b2 is created and bjam ok.
When b2 starts, everything crashes:
./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 means the "build" tool relies on "validation", so we go back and copy this:
cd ../boost_1_56_0
./dist/bin/bcp --namespace=myboost inspect ../myboost
cd ../myboost
./b2
which results in an 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 this means that "build" also depends on the wave ...
cd ../boost_1_56_0
./dist/bin/bcp --namespace=myboost wave ../myboost
cd ../myboost
./b2
At what point do I run into 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 found this particular bug related to the boost filesystem library mentioned in this ticket , but it had to be fixed, so I wasn't "expecting to see it in Boost 1.56.0, which is the latest release."
What's happening?
Why can't bcp create a build executable for just one boost library?
Why does the build depend on validation and waves adding LOT more headers to the extracted "myboost" than needed?
Any help on this would be appreciated.
source to share
I ran into a number of issues while 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
andb2 -j 8 tools\bcp
in the Boost source directory. (Here and below, replace8
with the number of concurrent jobs to run.) - At startup
.\dist\bin\bcp
, I found that I had to turntools\build\src
andlibs\config\checks\architecture
in my command line so that subsequent assembly work. - I also had to copy
bootstrap.bat
,boost-build.jam
andboostcpp.jam
in my copied boost. - I don't know why, but I had to rename the original Boost directory (i.e. the one it was launched from
bcp
), otherwise the build will somehow go back there.
After that, going to my copied directory and running bootstrap.bat
it allowed me to modify my Boost shorthand with a top level namespace extension.
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
source to share