安装python2.7的时候加入--enable-shared参数时,在make阶段会有一下错误
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
我的解决方法是make && make install 执行2遍就可以通过了,具体原因不知道...,以下是我的操作记录
[root@vhost141 Python-2.7.2] ./configure --enable-shared
[root@vhost141 Python-2.7.2]make && make install
[root@vhost141 Python-2.7.2]whereis libpython2.7.so.1.0
libpython2.7.so.1: /usr/local/lib/libpython2.7.so.1.0
[root@vhost141 Python-2.7.2] vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib/
[root@vhost141 Python-2.7.2] /sbin/ldconfig
[root@vhost141 Python-2.7.2] /sbin/ldconfig -v | grep libpython2.7.so
libpython2.7.so.1.0 -> libpython2.7.so.1.0