[mod_python] Help installing mod_python on OS X Leopard

Graham Dumpleton graham.dumpleton at gmail.com
Wed Jul 22 21:07:59 EDT 2009


2009/7/23 Scott Zetlan <scott at zetlan.net>:
> 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?

You are not doing anything wrong, even the mod_python code in
subversion trunk is now not likely to build properly on newer MacOS X
versions, especially with MacPorts and newer Python versions.

My first question would be whether you really need to use mod_python?

If you are using a Python web application that supports WSGI, you
would be better off using mod_wsgi as it has sorted out all these
build issues for newest MacOS X versions and Python installations.
Even then for certain combinations, and if wanting to use mod_wsgi
2.X, as opposed to mod_wsgi 3.0 release candidates, you need to drag
down configure/Makefile from subversion repository to get it to build.
There will be a mod_wsgi 2.6 which has more MacOS X build fixes soon
though.

At the moment I am not particularly inclined to be going back and
patching mod_python any further to resolve such issues.

Graham



More information about the Mod_python mailing list