Windows安装 ``` bash Remove-Item b2.exe, bjam.exe -Force -ErrorAction SilentlyContinue $mingwPath = "C:\Path\Qt5.12.12\Tools\mingw730_64\bin\" $env:PATH = "$mingwPath;$env:PATH" $env:CC = "$mingwPath\gcc.exe" $env:CXX = "$mingwPath\g++.exe" $env:RC = "windres --target=pe-x86-64" .\bootstrap.bat gcc --verbose .\b2 toolset=gcc --build-type=complete install --prefix="C:\Work\boost_64" -j8 ``` linux安装 ``` bash ./bootstrap.sh vim project-config.jam ./b2 link=static toolset=gcc address-model=64 --prefix=/work/lib/boost/gcc install ``` ``` bash ./b2 \ --prefix=./install \ # 安装到当前目录的 install 目录(可修改为绝对路径) --static \ # 仅生成静态库 --disable-shared \ # 禁用动态库(可选,若需纯静态建议开启) variant=debug,release \ # 同时生成 Debug 和 Release 版本 runtime-link=static \ # 静态链接运行时库(可选,部分场景需要) cxxflags="-std=c++17 -Wall" \ # 指定 C++ 标准和编译警告 --with-system \ # 编译 system 库(示例,按需添加其他库,如 filesystem、program_options 等) --with-thread \ # 编译 thread 库 --with-date_time \ # 编译 date_time 库 --install # 编译后安装到 --prefix 指定路径 ``` ``` project-config.jam if ! gcc in [ feature.values ] { using gcc : : /opt/gccs/dg-gcc-aarch64-7.4.1/bin/aarch64-linux-gnu-gcc ; } ``` ./b2 --static --disable-shared variant=debug,release toolset=gcc address-model=64 --prefix=/work/lib/boost/gcc12 install .\b2 toolset=gcc --build-type=complete --prefix=/work/lib/boost/gcc12_2 install