Re building Python and mod_wsgi

2019-08-10 22:04发布

问题:

I had a problem which i described here mod_wsgi Apache error with django app

finally I got to the point where i need to rebuild mod_wsgi.

The server is RHEL 6, so have python 2.6 installed by default and in order to run some stuffs another admin installed python 2.7 additionally

Now, I have this problem

/usr/bin/ld: /usr/local/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

According to https://code.google.com/p/modwsgi/wiki/InstallationIssues the problem I have is a conflict between python that was compiled to 32 bit and mod_wsgi to 64

Following this guide https://www.fir3net.com/Programming/Python/how-do-i-compile-modwgsi-for-python-27.html (and others) I'm trying to rebuild Python2.7 with --enabled-shared , but I got the same error when I run the make

/usr/bin/ld: /usr/local/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
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

Python build finished, but the necessary bits to build these modules were not found:
bsddb185           dl                 imageop         

I dont know if the problem is the previous installation of python 2.7. There is a safe way to remove whole python 2.7 previous installation? I don't know if that can solve the problem.

回答1:

Finally just deleted the /usr/local/lib content and rebuild python and mod_wsgi