Centos 安裝boost庫


1.在http://www.boost.org/下載boost安裝包boost_1_65_1.tar.gz

2.在Centos上解壓tar -zxvf  boost_1_65_1.tar.gz后,cd進入boost_1_65_1目錄

3.安裝boost庫到指定目錄

./b2 install --prefix=/home/dj/lib/boost/ 

4.如果為了引用方便將目錄加到環境變量中

在/etc/profile文件中添加

export CPLUS_INCLUDE_PATH=/home/dj/lib/boost/include:$CPLUS_INCLUDE_PATH

export LIBRARY_PATH=/home/dj/lib/boost/lib:$LIBRARY_PATH

export LD_LIBRARY_PATH=/home/dj/lib/boost/lib:$LD_LIBRARY_PATH

 

 

安裝出現問題:

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生效

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM