最简步骤
Here's the quick way I did it:
$ sudo ./bootstrap.sh --prefix=/usr/local
$ sudo ./b2 install
The library and header files will be installed in /usr/local. Header files will be put in /usr/local/include and the libs will be put in /usr/local/lib/. Change the /usr/local path if you need it installed in another place.
If you need, i recommend it, add the two paths to the PATH variable:
$ export PATH=$PATH:/usr/local/include/:/usr/local/lib/
To make it permanent add the above line to ~/.profile
file.
CentOS7上使用clang进行编译
安装编译工具 clang ,也可以使用 gcc 代替,只需要将下面命令中的 clang 替换为 gcc 即可
yum install clang
编译 boost(同时编译所有的 boost lib, 内存和 CPU 如果不够的话可能会编译失败甚至导致系统死机 )
cd boost_1_65_1/
# 可以通过 ./bootstrap.sh --help 查看更多选项
./bootstrap.sh --with-toolset=clang --with-libraries=all --prefix=/usr/local
./b2
Unable to build Boost.Python
编译Boost.Python模块的时候出现该问题,The problem was not installing the python-devel or python-dev package corresponding to my python version.
First of all, if you try to run yum install python27-devel
, then you should get the message like this:
No package python27-devel available
Then I followed this link,
yum search python | grep -i devel
This will show you that you have python-devel.x86_64
package available if your OS is a 64 bit OS. If I am correct, then the following command should work fine as shown in the accepted answer:
yum install python-devel.x86_64