Boost libraries - build only what I need

前端 未结 6 672
囚心锁ツ
囚心锁ツ 2020-12-22 23:54

I downloaded the Boost libraries and now I want to build only a few of the libraries. What would be the right command for this? Apparently the built-type=complete option giv

相关标签:
6条回答
  • 2020-12-23 00:09

    My last build attempt for the Boost 1.55 libraries was a dissappointment. All attempts to build several libraries and only them has ended up with total mess in output.

    BJam either tries to build everything or build only the requested, but in the "bin.v2/[long-random-path]" folders (library per directory) with crap in them which is a headache to copy only the link libraries to somethere else.

    I have accidentally found the right way to build-and-collect only the libraries I want in one place without any other crap:

    bjam ... --with-[library1] --with-[library2] stage

    • the "stage" option is required to build and collect libraries in one folder: /stage/lib
    • the "--with-[library]" option is required to build only the library you want.
    0 讨论(0)
  • 2020-12-23 00:17

    In step 5.2.4 of Getting Started you can instruct b2 which libraries to build:

    ./b2 --with-program_options --with-filesystem --with-system
    

    Alternatively, use ./b2 --show-libraries to see a list of all libraries that are not header-only.

    Following is an excerpt from the page:

    In particular, to limit the amount of time spent building, you may be interested in:

    • reviewing the list of library names with --show-libraries
    • limiting which libraries get built with the --with-<library-name> or --without-<library-name> options
    • choosing a specific build variant by adding release or debug to the command line.

    Note: b2 command depends upon boost version so use following commands as per your boost version(Also, in this case use --with-libraries=<comma-seperated-library-names> version instead of --with-<library-name>):

    • ./configure for 1.38.0 and earlier
    • ./bootstrap.sh for 1.39.0 onwards till 1.46.0
    0 讨论(0)
  • 2020-12-23 00:17

    These answers didn't work for me. On Windows, this worked for me:

    b2.exe -with-LIBRARY
    

    For example,

    b2.exe -with-test
    
    0 讨论(0)
  • 2020-12-23 00:22

    The BCP utility is a tool for extracting subsets of Boost. It's useful for Boost authors who want to distribute their library separately from Boost, and for Boost users who want to distribute a subset of Boost with their application.

    The current version of Boost (1.50.0) uses Boost.Build. The new workflow for building BCP is as follows:

    From the root Boost directory, type:

    bootstrap.bat
    

    Then, once Boost.Build has been built, type:

    b2 tools/bcp
    

    To extract, for example interprocess only, you could use:

    $ mkdir /tmp/interprocess #bcp needs this
    $ bcp interprocess /tmp/interprocess
    

    This copies interprocess and its dependencies to /tmp/interprocess.

    0 讨论(0)
  • 2020-12-23 00:24

    An additional note for anyone who sees the error message: "error: wrong library name '<name of library>' in the --with-<library> option.".

    If you try to be clever, as I did, and only extract the boost sub-directory of the download onto your system to minimise space, b2 will not be able to find the source code and build options for those libraries that are not header-only. I.e. you need the lib sub-directory too (and tools).

    0 讨论(0)
  • 2020-12-23 00:30

    I had the same problem. But I found a way to create the necessary files.

    Steps to follow:

    1. If you have Microsoft Visual Studio 2010 then open the Microsoft Visual Studio command prompt (2010) in administrator mode.
    2. First enter the code:

      bootstrap.bat
      
    3. Then enter the following code to generate lib files:

      b2.exe link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-system --toolset=msvc-10.0 define=BOOST_USE_WINAPI_VERSION=0x0500
      
    4. Library files will be created in stage folder.

    0 讨论(0)
提交回复
热议问题