Building Boost BCP

后端 未结 4 1916
长情又很酷
长情又很酷 2020-12-12 20:49

I was trying to build Boost C++ Libraries for last two hours and stopped without any result. Since I am new to C++, I am unable to get the build right. How can I build it co

相关标签:
4条回答
  • 2020-12-12 21:02

    I extracted the source: https://github.com/district10/cmake-bcp (You don't need to configure BOOST, cause all source code are included already).

    On Linux, cmake + make to build:

    # cd source_dir
    mkdir build && cd build
    cmake ..
    make
    

    On Windows: CMake-GUI + Visual Studio to build. Need help? See HOWTO: Win + CMake + Visual Studio 2010.

    My executables:

    • Windows: http://whudoc.qiniudn.com/2016/bcp_standalone.exe (561 KB)
    • Linux: http://whudoc.qiniudn.com/2016/bcp_standalone_linux (917 KB)
    • macOS: https://github.com/district10/cmake-bcp/releases/download/1.0/macOS_bcp (801 KB)

    Tip: If you come across linking problems on Windows when using Boost, go check the boost/config/auto_link.hpp and you'll understand. To resolve this, you can just comment out the whole file.

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-12-12 21:21

    Note that you don't need to build your Windows versions of bcp from source -- you can also download a binary version from http://www.boostpro.com/download, and skip all those steps.

    (Or, at least, that's the case in theory -- I haven't tried it; I just found that page and this one while looking for a pre-built Linux version.)

    0 讨论(0)
  • 2020-12-12 21:28

    First, you need to have the proper PATH, INCLUDE and LIB environment variables in your command shell. For this, call the file "vcvarsall.bat" (or similar) with parameter:

    vcvarsall.bat x86
    

    Next you have to build bjam (you can also download it from the Boost page, but it's almost as quick). Go to the tools\jam\src folder in Boost and type:

    build.bat
    

    It should produce a subfolder bin.ntx86 that contains bjam.exe. For convenience, copy it to the Boost main folder. Next, you can build bcp. Go into the tools\bcp folder and type:

    ..\..\bjam.exe --toolset=msvc
    

    Back in the Boost main folder you can then build any library you wish:

    bjam toolset=msvc –-with-{library}
    

    where {library} is one of the libraries to build. All buildable libraries can be shown with:

    bjam –-show-libraries
    

    There are many more bjam build parameters. Some parameters with keywords you can specify are:

    variant=debug|release
    link=shared|static
    threading=multi|single
    

    An example would be:

    bjam toolset=msvc –-with-filesystem threading=multi variant=debug stage
    

    For more infos, visit the Boost documentation pages.

    Edit: Updated link to point to most recent Boost documentation

    Edit: Corrected options --with-{library} and –-show-libraries

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