Fixing/Adding 符号链接

Fixing/Adding symlink

我正在尝试编译 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

在此处阅读文档 -

http://code.google.com/p/modwsgi/wiki/InstallationIssues#Lack_Of_Python_Shared_Library

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

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

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

Python executable not finding libpython shared library

之后我可以使用 64 位版本的 mod-wsgi。