问题
Boost using this build system I'm not otherwise familiar with, based on "Jam" files. Now, I've forked and cloned a specific Boost library (program_options), and I want to build it and perhaps also run the tests. I notice a build/Jamfile.v2
- what should I do with it?
I tried apt-get install jam
on my distribution, but that did not get me very far:
$ jam -fbuild/Jamfile.v2
warning: unknown rule project
warning: unknown rule boost-lib
don't know how to make all
...found 2 target(s)...
...can't find 1 target(s)...
Also, do I have to get the absolute latest development version of all of Boost to build the cloned library against, or can I use a local boost release I already have?
Notes:
- I'm on a recent GNU/Linux distribution (Mint 18.3 but this shouldn't matter).
回答1:
What I've done, based on @SergeyA and others' advice, is:
- Clone all of Boost, recursively (see this page (this will create a
boost/
folder ) cd boost
- in
.git/modules/my_boost_lib/config
, change the origin URL to your fork - in
.gitmodules
, under[submodule "my_boost_lib"]
, change the URL to your fork - execute
git submodule update --init libs/my_boost_lib/
(perhaps after deleting that library; not sure if that's actually necessary) cd libs/my_boost_lib/build
../../../b2
The latter works because b2
looks for a Jamfile.v2
in its current working directory, and that file exists and is intended to build just the library. The build results will be located outside of libs/my_boost_lib
though.
Note: To build run the library tests, build the same way but from libs/my_boost_lib/test
.
回答2:
Essentially the build steps is
- Run bootstrap to build the build tool b2
- Build boost with b2 install or similar. You may want to provide options to it.
Read more in the boost getting started document: http://www.boost.org/doc/libs/1_66_0/more/getting_started/index.html (hint, look at lower right to go to next page..)
If you are on windows / VS2017, the use of vcpkg to get boost is very easy.
来源:https://stackoverflow.com/questions/48714581/how-can-i-build-an-individual-boost-library-forked-cloned-from-git