Problems compiling mod_wsgi in virtualenv

I am trying to compile mod_wsgi (version 3.3), Python 2.6, on a CentOS server, but in virtualenv , without success. I get an error message:

/USR/ ben / ld: / home / python 26 / lib / libpython2.6.a (node.o): moving R_X86_64_32 against `a local character" cannot be used when creating a shared object; recompile -fPIC

/home/python26/lib/libpython2.6.a: unable to read characters: Bad value

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

  • does not exist
  • was not created in conjunction with
  • was created for a 32-bit machine, not a 64-bit version.

Well, the file is in the right place and is readable. I tried to recompile Python 2.6 with the --enable-shared option, but the whole compilation exploded, with approximately every file giving the same error as libpython2.6.a was closed.

I don't know that Python compiled 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 about this on x86_64, I hope it compiled for 64-bit - if anyone could confirm this, I would appreciate it.

I tried to configure the make_file mod_wsgi file with and without --python = / home /[...†/ python2.6, both paths exploded.

I also tried compiling mod_wsgi outside of virtualenv using Python 2.4 and it worked fine. Unfortunately, this will not help me if I use virtualenv :)

Does anyone know how I can get mod_wsgi to compile under virtualenv ?

+6
source share
3 answers

Relevant parts of the documentation:

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

This mentions the -fPIC issue.

and

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

This indicates the need to use LD_RUN_PATH when the mod_wsgi shared library cannot be found.

Additional information can be found about common problems with the library, as well as problems with detecting an incorrect Python installation in the mod_wsgi module at:

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

+8
source

If you created Python from sources, add --enable-shared for customization. (He adds -fPIC)

+3
source

You must recompile libpython2.6.a with -fPIC to generate the object.

For instance:

 gcc -fPIC -g -c -Wall xxx.c 
+1
source

Source: https://habr.com/ru/post/888955/


All Articles