修复/添加符号链接

时间:2015-12-15 03:01:29

标签: python python-2.7 mod-wsgi

我正在尝试编译mod_wsgi以便在我的centos 6.6服务器上使用python2.7。

我已下载源代码并运行以下命令 -

./configure --with-python=/usr/local/bin/python2.7 --disable-framework

哪个运行正常。但是,当我尝试运行make时,我得到以下内容 -

/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' 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
apxs:Error: Command failed with rc=65536
.
make: *** [src/server/mod_wsgi.la] Error 1

编辑 - 我运行了以下命令,我的Python2.7是64位 -

import struct
print struct.calcsize("P") * 8

我也试过做一个pip2.7安装mod_wsgi,我得到以下内容 -

/usr/local/lib/python2.7/config -lpython2.7
    /usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' 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
    error: command 'gcc' failed with exit status 1

在阅读这里的文件时 -

https://stackoverflow.com/a/34230983/918910

我的符号链接似乎有问题。我将如何创建或替换他们在这里引用的符号链接 -

If the version of Python being used was compiled for X86 64 bit architecture and a shared library does exist, but not in the 'config' directory, then adding the missing symlink may be all that is required.

我已经确认Python2.7是64位安装,我运行以下命令来配置它,所以它确实是一个共享环境 -

./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

1 个答案:

答案 0 :(得分:0)

我需要重新编译我的Python,如以下文档中所示 -

Python executable not finding libpython shared library

之后我能够使用64位版本的mod-wsgi。