3

I have a centos 6 server, and I'm trying to configure apache + wsgi + django but I can't. As I have Python 2.6 for my system and I using Python2.7.5, I can't install wit yum. I was dowload a tar file and try to compile using:

./configure --with-python=/usr/local/bin/python2.7

But not works. Systems respond:

/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

I don't understand where I have to use -fPIC. I'm execute:

./configure -fPIC --with-python=/usr/local/bin/python2.7

But not works.

Can anyone help me?

karthikr
  • 97,368
  • 26
  • 197
  • 188
Rodrigo
  • 43
  • 1
  • 7

3 Answers3

1

This is covered in the mod_wsgi documentation.

Your Python installation wasn't configured with the --enable-shared option when it was built. You cannot workaround it at the time of building mod_wsgi. Your Python installation needs to be reinstalled with the correct configure option.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134
  • How do you do this in virtual-env though? – user83039 Jan 11 '15 at 04:20
  • You have to rebuild the Python installation that your virtual environment was constructed with and then likely reconstruct the virtual environment. Don't understand what you mean otherwise. – Graham Dumpleton Jan 11 '15 at 04:23
  • Virtual env adds a Python inside of it. So I should delete the default one with `rm -rf` and then download and compile it with that option? `virtualenv env` won't take the option `--neable-shared`, will it? – user83039 Jan 11 '15 at 04:26
  • The --enable-shared option has to be supplied to the 'configure' script for the main Python installation when it was installed. Are you sure the above problem is even the same as what you have because if you actually did compile your Python installation from source code you would know it and understand. How did you install Python in the first place? – Graham Dumpleton Jan 11 '15 at 04:29
0

I assume you are on a shared hosting server, mod_wsgi is not supported on most of shared hosting providers.

Al Kafri Firas
  • 323
  • 3
  • 15
  • Actually no, I'm working on my own server. I'm using a virtual server created with VirtualBox. I need to publish coming soon – Rodrigo Aug 09 '13 at 15:07
-1

Try using nginx server, it seems to be much easier to deploy.

Here is a good tutorial for deploying to EC2 but you can use parts of it to configure the server.

Emil Davtyan
  • 13,808
  • 5
  • 44
  • 66