1.在http://www.boost.org/下載boost安裝包boost_1_65_1.tar.gzpython
2.在Centos上解壓tar -zxvf boost_1_65_1.tar.gz後,cd進入boost_1_65_1目錄ui
3.安裝boost庫到指定目錄blog
./b2 install --prefix=/home/dj/lib/boost/ get
4.若是爲了引用方便將目錄加到環境變量中io
在/etc/profile文件中添加編譯
export CPLUS_INCLUDE_PATH=/home/dj/lib/boost/include:$CPLUS_INCLUDE_PATHthread
export LIBRARY_PATH=/home/dj/lib/boost/lib:$LIBRARY_PATH變量
export LD_LIBRARY_PATH=/home/dj/lib/boost/lib:$LD_LIBRARY_PATHgcc
安裝出現問題:file
1.fatal error: pyconfig.h: No such file or directory,
缺乏python依賴包
Ubuntu上 apt-get install python-dev
Centos上 yum install python-devel
2.Fatal error: can't create bin.v2/libs/python/build/gcc-4.8.5/release/link-static/threading-multi/converter/from_python.o: Permission denied
權限被限制
使用 sudo ./b2 install --prefix=/home/dj/lib/boost/
3.編譯程序出現錯誤
/usr/bin/ld: build/objs/Wrap.o: undefined reference to symbol 'pthread_kill@@GLIBC_2.2.5'
/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
在Makefile文件中 LIBS 添加 pthread
4.error while loading shared libraries: libboost_system.so.1.65.1: cannot open
這是找不到動態連接庫的位置
首先 find / -name libboost_system.so.1.65.1 找到文件位置
而後在/etc/ld.so.conf 文件最後添加 /home/dj/lib/boost/lib 即動態庫所在目錄
/sbin/ldconfig是/etc/ld.so.conf生效