CentOS error with mod_wsgi: cannot find -lpython3.2

0

I've been trying to install mod_wsgi configured for Python 3.2 on a CentOS machine and I keep running into the error:

/usr/bin/ld: cannot find -lpython3.2

As near as I can tell this is caused by a missing libpython3.2.so or equivalent, but I can't seem to figure out how to create that file.

Some pertinent data:

  1. The Python install is 3.2, downloaded from python.org as a tar.bz2
  2. The md5sum of Python-3.2.tar.bz2 matches the one on Python.org
  3. This problem happens both with the version of mod_wsgi from the hg repository and from mod_wsgi-3.3.tar.gz

(I do realize this could also be a serverfault question, but this seemed like the more intuitive forum).

(Output below for reference)

[root@<>mod_wsgi-3.3]# ./configure PYTHON=/usr/local/bin/python3.2
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
checking Apache version... 2.2.3
configure: creating ./config.status
config.status: creating Makefile
[root@<> mod_wsgi-3.3]# make
... (I will include this if requested, but it makes it easier to 
    read if this is removed)
mod_wsgi.c:7154: warning: 'wsgi_set_py3k_warning_flag' defined but not used
mod_wsgi.c:7856: warning: 'wsgi_set_user_authoritative' defined but not used
mod_wsgi.c:14414: warning: 'wsgi_hook_check_user_id' defined but not used
/usr/lib/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la  -rpath /usr/lib/httpd/modules -module -avoid-version    mod_wsgi.lo -L/usr/local/lib
-L/usr/local/lib/python3.2/config -lpython3.2 -lpthread -ldl -lutil -lm
/usr/bin/ld: cannot find -lpython3.2
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
[root@<> mod_wsgi-3.3]#

cwallenpoole

Posted 2011-09-01T17:09:18.390

Reputation: 742

Can you list the files under /usr/local/lib/python3.2/config in your post? – John T – 2011-09-01T17:23:20.557

It does not seem to be there... Was this an install directive I missed? – cwallenpoole – 2011-09-01T17:28:32.820

The makefile is looking for a config in that directory for the linker (ld). You can modify the makefile to point to your Python install or re-install python under the standard directory. – John T – 2011-09-01T18:06:52.140

How would I go about finding out how to do that? (I'm just using ./configure --enable-shared; make; make install for the Python install) – cwallenpoole – 2011-09-01T18:39:55.170

What are all the actual 'configure' arguments you supplied when building Python? For mod_wsgi, to indicate where Python installed, you are supposed to use --with-python option and not set PYTHON variable when running configure. – Graham Dumpleton – 2011-09-01T20:16:43.203

I built python with ./configure --enable-shared; make; make install – cwallenpoole – 2011-09-01T20:32:43.627

As to PYTHON= vs. --with-python=, it appears (based on the configure file) that both accomplish the same thing. Either way, neither one works. – cwallenpoole – 2011-09-01T20:33:59.740

Answers

0

If you built Python 3.2 with:

./configure --enable-shared; make; make install

as you say, then that would actually have installed under /usr and not under /usr/local. Thus it would look like you may have two Python installations for 3.2 and your PATH or the PYTHON settings means you are picking up the one under /usr/local and not the one that got installed under /usr based on your configure settings for Python. Work out how many Python installations you actually have, where and what versions. Also make sure that when you are rebuilding source code for either Python or mod_wsgi that you do:

make distclean

between builds to ensure you don't have anything left from previous builds from a prior configuration.

Note that it is preferable to edit your original question to add extra information and not only add it in comments where it is hard to find.

Graham Dumpleton

Posted 2011-09-01T17:09:18.390

Reputation: 256