[mod_python] Help installing mod_python on OS X Leopard

Scott Zetlan scott at zetlan.net
Wed Jul 22 12:47:54 EDT 2009


Apologies if I'm rehashing an old issue, but I've reviewed threads for  
installation of mod_python on OS X, and don't seem to be getting the  
error resolution quite right.

I have a MacPorts-installed Python2.6 as well as the out-of-the-box  
Python2.5 on my OS X host.  In theory I can swap between them by  
editing my profile?  So when my path points to the Apple-delivered  
python (2.5), and I attempt to install, I wind up with a mod_python  
that appears to be missing references to the framework entirely:

$ otool -L /usr/libexec/apache2/mod_python.so
/usr/libexec/apache2/mod_python.so:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
version 111.1.4)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current  
version 1.0.0)

and apachectl configtest reports:
httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf:  
Cannot load /usr/libexec/apache2/mod_python.so into server: dlopen(/ 
usr/libexec/apache2/mod_python.so, 10): Symbol not found:  
_PyObject_GenericGetAttr\n  Referenced from: /usr/libexec/apache2/ 
mod_python.so\n  Expected in: dynamic lookup\n

using the MacPorts version, I've changed the LDFLAGS in src/Makefile  
to read:
LDFLAGS= -Wl,-framework,Python  -u _PyMac_Error $(PYTHONFRAMEWORKDIR)/ 
Versions/$(VERSION)/$(PYTHONFRAMEWORK)   -arch ppc -arch i386 -isy     
sroot /Developer/SDKs/MacOSX10.4u.sdk -g -arch x86_64 -Wl,-F/Library/ 
Frameworks/Python.framework

and compiling/installing produces /usr/libexec/apache2/mod_python.so,  
with this otool output:
$ otool -L /usr/libexec/apache2/mod_python.so
/usr/libexec/apache2/mod_python.so:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current  
version 111.1.4)
	/Library/Frameworks/Python.framework/Versions/2.6/Python  
(compatibility version 2.6.0, current version 2.6.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current  
version 1.0.0)

this seems right, but I get the same dlopen error on apachectl  
configtest:
httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf:  
Cannot load /usr/libexec/apache2/mod_python.so into server: dlopen(/ 
usr/libexec/apache2/mod_python.so, 10): Symbol not found:  
_PyObject_GenericGetAttr\n  Referenced from: /usr/libexec/apache2/ 
mod_python.so\n  Expected in: dynamic lookup\n

Any clues on what I am doing wrong?


More information about the Mod_python mailing list