Problems compiling mod_wsgi in virtualenv

2024/9/26 1:24:57

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 `alocal symbol' can not be used whenmaking 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?

Answer

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

https://en.xdnf.cn/q/71513.html

Related Q&A

Python - Multiprocessing Error cannot start a process twice

I try to develop an algorithm using multiprocessing package in Python, i learn some tutorial from internet and try to develop an algorithm with this package. After looking around and try my hello world…

Printing unicode number of chars in a string (Python)

This should be simple, but I cant crack it. I have a string of Arabic symbols between u\u0600 - u\u06FF and u\uFB50 - u\uFEFF. For example غينيا واستمر العصبة ضرب قد. How do I pri…

Pandas report top-n in group and pivot

I am trying to summarise a dataframe by grouping along a single dimension d1 and reporting summary statistics for each element of d1. In particular I am interested in the top n (index and values) for …

virtualenv --no-site-packages is not working for me

virtualenv --no-site-packages v1cd v1\Scriptsactivate.batpython -c "import django" # - no problem hereWhy does it see the Django package??? It should give me an import error, right?

pandas: Group by splitting string value in all rows (a column) and aggregation function

If i have dataset like this:id person_name salary 0 [alexander, william, smith] 45000 1 [smith, robert, gates] 65000 2 [bob, alexander] …

Seaborn Title Position

The position of my graph title is terrible on this jointplot. Ive tried moving the loc = left, right, and center but it doesnt move from the position its in. Ive also tried something like ax.title.set_…

Expand/collapse ttk Treeview branch

I would like to know the command for collapsing and expanding a branch in ttk.Treeview.Here is a minimalistic example code:#! coding=utf-8 import tkinter as tk from tkinter import ttkroot = tk.Tk() tre…

Uploading images to s3 with meta = image/jpeg - python/boto3

How do I go about setting ContentType on images that I upload to AWS S3 using boto3 to content-type:image/jpeg?Currently, I upload images to S3 using buto3/python 2.7 using the following command:s3.up…

How to use win environment variable pathlib to save files?

Im trying to use win environment variable like %userprofile%\desktop with pathlib to safe files in different users PC.But Im not able to make it work, it keep saving in on the running script dir.import…

Difference between starting firestore emulator through `firebase` and `gcloud`?

What is the difference between starting the firestore emulator through: firebase emulators:start --only firestoreand: gcloud beta emulators firestore startBoth options allow my python app to achieve co…