Error: Command failed with rc=65536 python and mod_wsgi

2024/10/8 4:28:07

i'm having this problem:

i'm runing pythonbrew to get python2.7, and so i re-compiled mod_wsgi to use the 2.7 python.

to that end, i followed this tutorial:

code.google.com/p/modwsgi/wiki/QuickInstallationGuide

which involved downloading the file - there is a tar.gz file i get - and then "configuring it" with ./configure --with-python=/home/bharal/.pythonbrew/pythons/Python-2.7.2/bin/python --enable-shared

now i'm assuming this is the right place to attach for my python - the value for with-python above is just the response i get to a which python

OK! So, now the problem. After i run the configure above, i run make and i get:

/usr/include/features.h:160:1: warning: this is the location of the previous definition
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static x86_64-linux-gnu-gcc -o mod_wsgi.la  -rpath /usr/lib/apache2/modules -module -avoid-version    mod_wsgi.lo -L/home/aiyer    /.pythonbrew/pythons/Python-2.7.2/lib -L/home/aiyer/.pythonbrew/pythons/Python-2.7.2/lib  /python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /home/bharal/.pythonbrew/pythons/Python-2.7.2/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
/home/aiyer/.pythonbrew/pythons/Python-2.7.2/lib/libpython2.7.a: could not read symbols: Bad  value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

And i have no idea what to do. I came across this answer is SO:

https://stackoverflow.com/a/6118155/1061426

but this doesn't help me any much - it isn't as far as i can tell a series of steps, but more an interesting tidbit to think about.

I ran this command to check if i have python 64 bit:

import sys
print maxint

if 64 bit ==> 9223372036854775807 if 32 bit ==> 2147483647

ok, so i'm totes running 64bit because i get the bigger number. So i read this doco here:

http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bit_Packages

because i'm running the 64 bit python, does that mean that my problem isn't this:

This error is believed to be result of the version of Python being used having been originally compiled for the generic X86 32 bit architecture whereas mod_wsgi is being compiled for X86 64 bit architecture. The actual error arises in this case because 'libtool' would appear to be unable to generate a dynamically loadable module for the X86 64 bit architecture from a X86 32 bit static library.

but rather this?

Alternatively, the problem is due to 'libtool' on this platform not being able to create a loadable module from a X86 64 bit static library in all cases.

(the above quotes from the above link)

and if that is the case, what the heck do i do? I haven't the foggiest notion what to do in either scenario - and yes, i read the rest of that page, but it might as well have been written in greek ( i don't speak greek ).

any suggestions?

UPDATE: i never fixed this and ended up using the python my ubuntu came with - no difference from the running of my code's point of view.

Answer

The documentation says:

If the first issue, the only solution to this problem is to recompilePython for the X86 64 bit architecture. When doing this, it ispreferable, and may actually be necessary, to ensure that the'--enable-shared' option is provided to the 'configure' script forPython when it is being compiled and installed.

So, you need to reinstall Python from source code, ensuring the '--enable-shared' option is supplied to the 'configure' command for Python prior to running 'make'.

If 'pythonbrew' doesn't allow you to do that, then tell the pythonbrew people that the way they are building their Python version with shared library support is arguably broken and will prevent many embedded systems from failing to run.

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

Related Q&A

Why cant I freeze_panes on the xlsxwriter object pandas is creating for me?

I have a class whose objects contain pandas dataframes (self.before, and self.after below) and a save() method which uses xlsxwriter to export the data (which has two worksheets, "before" and…

Python multiprocessing pipe recv() doc unclear or did I miss anything?

I have been learning how to use the Python multiprocessing module recently, and reading the official doc. In 16.6.1.2. Exchanging objects between processes there is a simple example about using pipe t…

How would you unit test this SQLAlchemy Core query/function?

Im working on learning how to unit test properly. Given this function...def get_user_details(req_user_id):users = sa.Table(users, db.metadata, autoload=True)s = sa.select([users.c.username,users.c.favo…

Retrieve wall-time in Python using the standard library?

How can I retrieve wall-time in Python using the standard library?This question, and this question would suggest that something like clock_gettime(CLOCK_MONOTONIC_RAW) or /proc/uptime are most appropr…

NLTK: Package Errors? punkt and pickle?

Basically, I have no idea why Im getting this error. Just to have more than an image, here is a similar message in code format. As it is more recent, the answer of this thread has already been mentione…

Is there a bit-wise trick for checking the divisibility of a number by 2 or 3?

I am looking for a bit-wise test equivalent to (num%2) == 0 || (num%3) == 0.I can replace num%2 with num&1, but Im still stuck with num%3 and with the logical-or.This expression is also equivalent …

Check image urls using python-markdown

On a website Im creating Im using Python-Markdown to format news posts. To avoid issues with dead links and HTTP-content-on-HTTPS-page problems Im requiring editors to upload all images to the site and…

How to unittest command line arguments?

I am trying to supply command line arguments to Python unittest and facing some issues. I have searched on internet and found a way to supply arguments asunittest.main(argv=[myArg])The issue is this wo…

different foreground colors for each line in wxPython wxTextCtrl

I have a multilinewx.TextCtrl()object which I set its forground and Background colors for writing strings.I need to write different lines with different colors ,wx.TextCtrl.setForgroundcolor()changes a…

Access deprecated attribute validation_data in tf.keras.callbacks.Callback

I decided to switch from keras to tf.keras (as recommended here). Therefore I installed tf.__version__=2.0.0 and tf.keras.__version__=2.2.4-tf. In an older version of my code (using some older Tensorfl…