step0、参考
step1、安装依赖
所有时 | Terminal + Shell + GNU CoreUtils |
下载时 | cURL |
解压时 | tar + bzip2 |
编译时 | CPython、gcc / GCC | Clang / LLVM |
运行时 |
|
step2、使用curl命令下载boost
源码包 ()
curl -LO https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.bz2
step3、使用tar解压boost
源码包
tar vxf boost_1_73_0.tar.bz2
step4、进入boost_1_73_0
目录
cd boost_1_73_0
step5、查看boost_1_73_0
目录的内容
step6、生成b2
命令和project-config.jam
./bootstrap
step7、通过./b2
命令配置编译参数并安装
./b2 [option]... [property]... [target]...
公共property | 可取值 | 说明 |
---|---|---|
target-os | linux | darwin | android | 交叉编译 时候,需要设置目标系统 |
toolset | clang-arm | 设置使用哪个toolset |
variant | debug | release | debug,release | |
link | static | shared | static,shared | 生成静态库 还是动态库 |
runtime-link | static | shared | 以静态链接 还是动态链接 的方式进行链接库 |
threading | single | multi | 是否使用多线程 |
include | DIR | 设置额外的头文件搜索目录 |
库名称 | 库文件名 | 依赖库 |
---|---|---|
Boost.MPI | libboost_mpi.{a | so | dylib} |
open-mpi |
Boost.Log |
libboost_log.{a | so | dylib} libboost_log_setup.{a | so | dylib} |
|
Boost.Test | libboost_unit_test_framework.a |
|
Boost.Math | libboost_math_xx.{a | so | dylib} |
|
Boost.Wave | libboost_wave.{a | so | dylib} |
|
Boost.Fiber | libboost_fiber.{a | so | dylib} |
|
Boost.Timer | libboost_timer.{a | so | dylib} |
|
Boost.Regex | libboost_regex.{a | so | dylib} |
|
Boost.Nowide | libboost_nowide.{a | so | dylib} |
|
Boost.Thread | libboost_thread.{a | so | dylib} |
|
Boost.Atomic | libboost_atomic.{a | so | dylib} |
|
Boost.Locale | libboost_locale.{a | so | dylib} |
|
Boost.Python | libboost_python.{a | so | dylib} |
CPython |
Boost.System | libboost_system.{a | so | dylib} |
|
Boost.Random | libboost_random.{a | so | dylib} |
|
Boost.Chrono | libboost_chrono.{a | so | dylib} |
|
Boost.Context | libboost_context.{a | so | dylib} |
|
Boost.Contract | libboost_contract.{a | so | dylib} |
|
Boost.Coroutine | libboost_coroutine.{a | so | dylib} |
|
Boost.Container | libboost_container.{a | so | dylib} |
|
Boost.Date_Time | libboost_date_time.{a | so | dylib} |
|
Boost.Exception | libboost_exception.{a | so | dylib} |
|
Boost.Filesystem | libboost_filesystem.{a | so | dylib} |
|
Boost.Stacktrace | libboost_stacktrace.{a | so | dylib} |
|
Boost.Iostreams | libboost_iostreams.{a | so | dylib} |
|
Boost.Serialization | libboost_serialization.{a | so | dylib} |
|
Boost.Program_options | libboost_program_options.{a | so | dylib} |
示例:
./b2 install \
-q \
-d+2 \
-j$(nproc) \
--reconfigure \
--without-python \
--prefix=/usr/local/opt/boost \
-sICU_PATH=/usr/local/opt/icu4c \
-sICONV_PATH=/usr/local/opt/libiconv \
link=static,shared \
variant=release \
threading=multi