[mod_python] Compiling 2.7 statically

Gregory Bond gnb at itga.com.au
Mon Jul 7 14:20:28 EST 2003

I'm trying to compile mod_python 2.7 (plus mod_ssl) statically into apache
1.3.27.  I'm using Python 2.1.1 on Solaris 6.

The first problem is that the Apache link step fails, because the mod_python 
library (libpython.a) refers to symbols in the libpython2.1.a library, and 
this is never referenced anywhere.  

I worked around that by adding ".../libpython2.1.a -lm" to EXTRA_LIBS in src/

This allows me to build an apache binary, and get the "Hello World" mod_python 
app working.  But as soon as I try any substantial application, I get errors 
like this:

PythonHandler oneaccount: ImportError: ld.so.1: /opt/apache/bin/httpd: fatal: relocation error: file /usr/local/lib/python2.1/lib-dynload/cStringIO.so: symbol PyCObject_FromVoidPtr: referenced symbol not found

which makes sense as these symbols are potentially not needed by mod_python 
therefore the relevent .o files aren't sucked in from the .a file.  

So how do I make this work? Or is statically compiling in mod_python a doomed 

More information about the Mod_python mailing list