当我做“make”在mod_wsgi文件夹中时,我得到这个错误
我使用以下configuration
./configure --with-apxs=/usr/local/apache/bin/apxs --with-python=/opt/python27/bin/python
/ usr / bin / ld:/opt/python27/lib/libpython2.7.a(node.o):在创build共享对象时,不能使用针对“本地符号”的R_X86_64_32; 使用-fPIC /opt/python27/lib/libpython2.7.a重新编译:无法读取符号:错误值collect2:ld返回1退出状态apxs:错误:命令失败,rc = 65536
这个链接有解决scheme,但我不能完全理解
1)How can i found that i have compiled x32bit or x64 bit version of python 2)I didn't understand about what symbolic link he was talking about
重要的是用–enable-shared重buildPython。 符号链接注释是不相关的,如果你没有这样做,甚至不适用于最新的Python / mod_WSGI版本。
仅用--enable-shared重新编译Python是不够的,因为加载共享库时会出错 。
假设您将在/usr/local/bin安装Python 2.7.x,您应该使用LDFLAGS选项对其进行configuration:
cd Python-2.7.x make distclean # For re-compiling only ./configure --enable-shared --prefix=/usr/local LDFLAGS="-Wl,--rpath=/usr/local/lib" make sudo make altinstall
(使用altinstall而不是install来避免更改系统Python和手册页的符号链接。简而言之, install = altinstall + bininstall + maninstall )
mod_wsgi 假设(Apache的一个编译版本)安装在/usr/local/apache ,像这样编译对Python 2.7的mod_wsgi :
cd mod_wsgi-xxx ./configure LDFLAGS="-Wl,--rpath -Wl,/usr/local/lib" --with-apxs=/usr/local/apache/bin/apxs --with-python=/usr/local/bin/python2.7 make sudo make install
如果你编译没有LDFLAGS mod_wsgi ,Apache会抱怨:
Cannot load /usr/local/apache/modules/mod_wsgi.so into server: libpython2.7.so.1.0: cannot open shared object file: No such file or directory