tech stuff.

Posts Tagged ‘leopard apache mod_python

Installing Apache modules on Mac OS X Leopard

with 2 comments

Installing mod_python on my mac laptop was surprisingly difficult.  My first attempt of simply compiling it with {LD,C}FLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64" failed in a bit of a strange way.  It appeared to create a universal binary for the DSO, but apache failed to load it with the following error message:

httpd: Syntax error on line 118 of /Volumes/Workplace/pflex/2.1.x/Build/build/ValidationWeb/apache/etc/httpd.conf: Syntax error on line 22 of /Volumes/Workplace/pflex/2.1.x/Build/build/ValidationWeb/apache/etc/platform/i386.Mac OS X/httpd.conf: Can't locate API module structure `python_module' in file /usr/libexec/apache2/ dlsym(0x100201000, python_module): symbol not found

As it turns out, the build process was respecting the LDFLAGS & CFLAGS for processes called directly by make, but it was not passing them on to apxs.  Adding the following to src/Makefile (after the initial INCLUDE declaration) worked to put apxs on the right track:

INCLUDES+= -Wc,-arch -Wc,ppc -Wc,-arch -Wc,ppc64 -Wc,-arch -Wc,i386 -Wc,-arch -Wc,x86_64
INCLUDES+= -Wl,-arch -Wl,ppc -Wl,-arch -Wl,ppc64 -Wl,-arch -Wl,i386 -Wl,-arch -Wl,x86_64

So, the procedure to install mod_python is:

  1. Download source here
  2. ./configure
  3. Add above two lines to src/Makefile
  4. make
  5. sudo make install or sudo make install_dso

Written by Lee Verberne

2008-11-19 at 17:48