How can I build an individual boost library forked cloned from git?

。_饼干妹妹 提交于 2020-01-05 07:29:39

问题


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:

  1. Clone all of Boost, recursively (see this page (this will create a boost/ folder )
  2. cd boost
  3. in .git/modules/my_boost_lib/config, change the origin URL to your fork
  4. in .gitmodules, under [submodule "my_boost_lib"], change the URL to your fork
  5. execute git submodule update --init libs/my_boost_lib/ (perhaps after deleting that library; not sure if that's actually necessary)
  6. cd libs/my_boost_lib/build
  7. ../../../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

  1. Run bootstrap to build the build tool b2
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!