在 RedHat 上安装 mod_wsgi 时出错

在 RedHat 上安装 mod_wsgi 时出错

我正在尝试在 RedHat Linux 上安装 mod_wsgi。

我收到了这个错误:

apxs:Error: Command failed with rc=65536

答案似乎是这里,但我想我已经有 64 位 Python 了,所以我不清楚在这种情况下我应该做什么。

安装命令:

[django - ping@e02u35]~/mod_wsgi-3.3>./configure --with-python=/usr/local/python-2.7.1/bin/python
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
checking Apache version... 2.2.3
configure: creating ./config.status
config.status: creating Makefile

[django - ping@e02u35]~/mod_wsgi-3.3>make
/usr/sbin/apxs -c -I/usr/local/python-2.7.1/include/python2.7 -DNDEBUG   mod_wsgi.c -L/usr/local/python-2.7.1/lib -L/usr/local/python-2.7.1/lib/python2.7/config  -lpython2.7 -lpthread -ldl  -lutil -lm
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/local/python-2.7.1/include/python2.7 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c: In function 'wsgi_server_group':
mod_wsgi.c:949: warning: unused variable 'value'
mod_wsgi.c: In function 'Log_isatty':
mod_wsgi.c:1606: warning: unused variable 'result'
mod_wsgi.c: In function 'Log_writelines':
mod_wsgi.c:1743: warning: unused variable 'msg'
mod_wsgi.c: In function 'Adapter_output':
mod_wsgi.c:3022: warning: unused variable 'n'
mod_wsgi.c: In function 'Adapter_file_wrapper':
mod_wsgi.c:4036: warning: unused variable 'result'
mod_wsgi.c: In function 'wsgi_python_term':
mod_wsgi.c:5643: warning: unused variable 'tstate'
mod_wsgi.c:5642: warning: unused variable 'interp'
mod_wsgi.c: In function 'wsgi_python_child_init':
mod_wsgi.c:6792: warning: unused variable 'l'
mod_wsgi.c:6690: warning: unused variable 'interp'
mod_wsgi.c: In function 'wsgi_add_import_script':
mod_wsgi.c:7443: warning: unused variable 'error'
mod_wsgi.c: In function 'wsgi_add_handler_script':
mod_wsgi.c:7891: warning: unused variable 'dconfig'
mod_wsgi.c:7890: warning: unused variable 'sconfig'
mod_wsgi.c: In function 'wsgi_hook_handler':
mod_wsgi.c:8937: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8939: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8941: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8945: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8965: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8967: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c:8970: warning: suggest parentheses around assignment used as truth value
mod_wsgi.c: In function 'wsgi_daemon_worker':
mod_wsgi.c:10279: warning: unused variable 'duration'
mod_wsgi.c:10278: warning: unused variable 'start'
mod_wsgi.c: In function 'wsgi_hook_daemon_handler':
mod_wsgi.c:12499: warning: unused variable 'i'
mod_wsgi.c:12497: warning: unused variable 'elts'
mod_wsgi.c:12496: warning: unused variable 'head'
mod_wsgi.c: At top level:
mod_wsgi.c:7856: warning: 'wsgi_set_user_authoritative' defined but not used
mod_wsgi.c:14414: warning: 'wsgi_hook_check_user_id' defined but not used
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/python-2.7.1/lib -L/usr/local/python-2.7.1/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /usr/local/python-2.7.1/lib/libpython2.7.a(node.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/python-2.7.1/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

系统信息:

Linux 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
It looks like Python 2.4 is the default Python but it has versions up to 2.7.1 installed.

Python信息:

[django - ping@e02u35]~>/usr/local/python-2.7.1/bin/python
Python 2.7.1 (r271:86832, Apr  4 2011, 13:23:54) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

答案1

运行“file /usr/local/python-2.7.1/lib/libpython2.7.a”,因为它在“本地”听起来像从源代码构建的安装,并且可能不是一个有效的 ar 档案。

答案2

请参阅 mod_wsgi 文档:

您需要有一个 Python 共享库,而不仅仅是一个静态 .a。

相关内容