错误:命令失败,rc=65536 python和mod_wsgi

2024-05-16 13:03:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我有个问题:

我正在运行pythonbrew以获取python2.7,因此我重新编译mod_wsgi以使用2.7 python。

为此,我遵循了本教程:

code.google.com/p/modwsgi/wiki/QuickInstallationGuide

其中包括下载文件-有一个tar.gz文件-然后用./configure --with-python=/home/bharal/.pythonbrew/pythons/Python-2.7.2/bin/python --enable-shared“配置它”

现在我假设这是连接我的python的正确位置-上面的with python的值只是我对awhich python的响应

好的!所以,现在的问题是。在运行上述配置之后,运行make,得到:

/usr/include/features.h:160:1: warning: this is the location of the previous definition
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static x86_64-linux-gnu-gcc -o mod_wsgi.la  -rpath /usr/lib/apache2/modules -module -avoid-version    mod_wsgi.lo -L/home/aiyer    /.pythonbrew/pythons/Python-2.7.2/lib -L/home/aiyer/.pythonbrew/pythons/Python-2.7.2/lib  /python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /home/bharal/.pythonbrew/pythons/Python-2.7.2/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
/home/aiyer/.pythonbrew/pythons/Python-2.7.2/lib/libpython2.7.a: could not read symbols: Bad  value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

我不知道该怎么办。我发现答案是这样的:

https://stackoverflow.com/a/6118155/1061426

但这对我没有多大帮助——这并不是我能说出的一系列步骤,而是一个值得思考的有趣的小道消息。

我运行此命令以检查是否有64位python:

import sys
print maxint

如果64位==>;9223372036854775807 如果32位==>;2147483647

好吧,我是64位的图腾,因为我得到了更大的数字。所以我在这里读到这个文件:

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

因为我运行的是64位python,这是否意味着我的问题不是:

This error is believed to be result of the version of Python being used having been originally compiled for the generic X86 32 bit architecture whereas mod_wsgi is being compiled for X86 64 bit architecture. The actual error arises in this case because 'libtool' would appear to be unable to generate a dynamically loadable module for the X86 64 bit architecture from a X86 32 bit static library.

而是这个?

Alternatively, the problem is due to 'libtool' on this platform not being able to create a loadable module from a X86 64 bit static library in all cases.

(以上引自上述链接)

如果是这样,我该怎么办?我也不知道在场景中该做什么-是的,我读了那一页的其余部分,但它可能是用希腊语写的(我不会说希腊语)。

有什么建议吗?

更新: 我从未修复过这个问题,最终使用了我的ubuntu自带的python——这与我代码运行的角度没有区别。


Tags: 文件thetocommodwsgihomeis
2条回答

在Fedora 19 64bit中遇到这个问题后,我发现如果同时安装Python-devel和httpd-devel包,mod-wsgi将从源代码处编译和安装。

不过,我没有用Python。

文件上说:

If the first issue, the only solution to this problem is to recompile Python for the X86 64 bit architecture. When doing this, it is preferable, and may actually be necessary, to ensure that the '--enable-shared' option is provided to the 'configure' script for Python when it is being compiled and installed.

因此,您需要从源代码重新安装Python,确保在运行make之前,Python的“configure”命令中提供了“-enable shared”选项。

如果“pythonbrew”不允许您这样做,那么告诉pythonbrew人员,他们使用共享库支持构建Python版本的方式可能会被破坏,并将防止许多嵌入式系统无法运行。

相关问题 更多 >