Ubuntu20.04静态编译Boost记录
背景
其实Ubuntu20.04之后完全可以用apt安装自带的Boost,只不过如果想要安装特定版本的Boost和静态链接(性能、发布时可以不带上Boost动态库考量),可以如下文自己去编译Boost
下载Boost源码
地址:https://www.boost.org/users/history/version_1_72_0.html
指定安装位置
./bootstrap.sh --prefix=/usr/local/boost-1-72-0
编译release版本的boost库
./b2 toolset=gcc link=static runtime-link=static threading=multi
开始编译
sudo ./b2 install --prefix=/usr/local/boost-1-72-0
编译debug版本的boost库
./b2 toolset=gcc link=static runtime-link=static threading=multi
开始编译
sudo ./b2 install --prefix=/usr/local/boost-1-72-0 --buildtype=complete

浙公网安备 33010602011771号