Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems compiling mod_wsgi in virtualenv

I'm trying to compile mod_wsgi (version 3.3), Python 2.6, on a CentOS server - but under virtualenv, with no success. I'm getting the error:

/usr/bin/ld: /home/python26/lib/libpython2.6.a(node.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

/home/python26/lib/libpython2.6.a: could not read symbols: Bad value

According to the mod_wsgi Installation Issues docs, it could be that the libpython2.6.a file:

  • isn't there
  • wasn't generated with shared
  • was generated for a 32-bit machine, not 64-bit.

Well, the file is in the right place, and readable. I tried to recompile Python 2.6 with the --enable-shared option, but the entire compilation blew up, with roughly every file giving the same error, that libpython2.6.a was hosed.

I don't know that Python was compiling for 64-bit, but when I ran it, and did:

import platform
print platform.platform()
>>>Linux-2.6.18-028stab070.4-x86_64-with-redhat-5.6-Final

Since Python thinks it's on a x86_64, I would hope that it compiled for 64-bit - if anyone has any way of confirming that, I'd appreciate it.

I tried configuring the mod_wsgi Makefile with both with and without --python=/home/[...]/python2.6, both ways blew up.

I also tried compiling mod_wsgi outside of virtualenv, using Python 2.4, and it worked fine. Unfortunately, that doesn't help me if I'm going to be using virtualenv :)

Anyone know how I can get mod_wsgi to compile under virtualenv?

like image 293
John C Avatar asked May 24 '11 21:05

John C


1 Answers

Relevant parts of the documentation are:

http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#mixing-32-bit-and-64-bit-packages

This mentions the -fPIC problem.

And:

http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#unable-to-find-python-shared-library

This mentions need to use LD_RUN_PATH when shared library can't be found by mod_wsgi.

Additional information can be found about shared library issues as well as problems with mod_wsgi finding wrong Python installation at:

http://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#python-shared-library

like image 129
Graham Dumpleton Avatar answered Sep 20 '22 22:09

Graham Dumpleton