Centos 安装boost库

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

相关文章
相关标签/搜索