[mod_python] can't compile on linux?

Anastasios Hatzis ah at hatzis.de
Mon Nov 27 03:32:09 EST 2006

Mark Harrison wrote:
> So I had no problem building apache, python, and mod_python
> on my OS X box, but I'm having problems on my Linux box
> (surprising, because that is usually the most trouble-free
> compilation environment).
> ohm ~/mp2/src/mod_python-3.2.10$ uname -a
> Linux ohm 2.6.12-1.1372_FC3p2smp #1 SMP Wed Jul 27 18:07:20 PDT 2005 
> x86_64 x86_64 x86_64 GNU/Linux
> httpd-2.2.3
> Python-2.4.3
> (both configured with ./configure --prefix=/u0/mh/mp)
> mod_python-3.2.10
> (configured with
> ./configure --with-apxs=/u0/mh/mp/bin/apxs 
> --with-python=/u0/mh/mp/bin/python)
> The httpd and python both seem good, but I get this
> error when compiling mod_python.
> Any clues appreciated!
> Mark

I really can only clue, since I'm not used to compile software myself on 
Linux.  I had the same problems and I think the solution is as following 
(don't ask me for the technically accurate evidence, at least it worked 
on my OpenSUSE 10.0 64bit machine -- tribute goes also to Christopher 
Taylor who expierenced the same error message on his RHEL 64bit 
independent of me and put my nose to the right direction):

As I see on the citings you use a 64bit machine, right? When building 
Python I added the option "enable-shared" at the configuration. 
According to Christopher the 32bit linking/loading to a static library 
is not a problem but on 64bit it can be.

(1) tested with Python 2.5:
./configure --enable-shared

But this ain't enough. I also build Apache with 64bit support 
"-enable-lib64", but concrete configure options may be different on your 

(2) tested with Apache 2.2.3:
./configure --enable-mods-shared='headers dav dav-fs dav-lock ssl 
rewrite vhost-alias' -enable-lib64 --with-expat=builtin

Before you continue make sure that both libraries are there and to be 
found. As I see you explicitely defined apxs path. I did do this after 
my early attempts failed and pointed me to an apxs:error. I think you 
can leave that away.

(3) tested with mod_python 3.2.10:

I hope this works on your machine. But really make sure that the 
libraries can be found. I tried multiple times to compile and install 
these three apps from source and I always failed at mod_python and 
started again from the scratch (means: I installed Linux from image 
again). Even as I followed instruction as described here, it didn't work 
always. If you again get the problem just stubbornly retry "./configure" 
another time after first fail --this worked on my machine. Don't ask me 
why...! Also rebooting the machine worked after installing Python and 
HTTPD but before mod_python did work. I assume rebooting  was not the 
reason for success, but that I started a new shell which then set the 
library path variables to Python and Apache HTTPD which I have put into 
the .bashrc file after their successful installations.

Well, I hope I didn't confuse you too much and this will work for your 
machine. If not, hum,... hopefully there is someone else who can provide 
a better answer. ;-)

Good luck!


> /u0/mh/mp2/build/libtool --silent --mode=link gcc -o mod_python.la  
> -rpath /u0/m
> h/mp2/modules -module -avoid-version    hlistobject.lo hlist.lo 
> filterobject.lo
> connobject.lo serverobject.lo util.lo tableobject.lo requestobject.lo 
> _apachemod
> ule.lo mod_python.lo -L/u0/mh/mp2/lib/python2.4/config -Xlinker 
> -export-dynamic
> -lm -lpython2.4 -lpthread -ldl -lutil -lm
> /usr/bin/ld: /u0/mh/mp2/lib/python2.4/config/libpython2.4.a(abstract.o): 
> relocat
> ion R_X86_64_32 can not be used when making a shared object; recompile 
> with -fPI
> C
> /u0/mh/mp2/lib/python2.4/config/libpython2.4.a: could not read symbols: 
> Bad valu
> e
> collect2: ld returned 1 exit status
> apxs:Error: Command failed with rc=65536


Mit freundlichen Grüßen

i. A.
Anastasios Hatzis

Hatzis Edelstahlbearbeitung GmbH
Hojen 2
87490 Haldenwang (Allgäu)

Tel: 0 83 74 / 9 30 8-13
Fax: 0 83 74 / 9 30 8-10

Mobil: 0 15 20 / 8 59 28 78     ++NEU+++NEU+++NEU+

Handelsregister Kempten (Allgäu): HRB 4204
Umsatzsteuer-Identitätsnummer: DE 128791802
Geschäftsführer: Paulos Hatzis, Charalampos Hatzis


More information about the Mod_python mailing list