Compiling mod_perl 2 on OS X Lion

Since updating to the latest XCode on OS X Lion, we've been unable to build or use mod_perl 2 on our development machines. If we ignore the test failures and make install anyhow, we get this error message when trying to start Apache:

Cannot load /opt/local/apache2/modules/ into server: dlopen(/opt/local/apache2/modules/, 10): Symbol not found: _modperl_handler_anon_add

One of our developers discovered this morning that llvm/clang on OS X defaults to C99, but mod_perl expects the 89 "standard". As a result of this thread, we compiled mod_perl in the following manner:

perl Makefile.PL MP_APXS=/path/to/apache/bin/apxs MP_CCOPTS=-std=gnu89
make test
make install

And voila, we have a working mod_perl 2 on Lion.

Come to find out, while researching this blog post, the macports people have already run into this:

Hope this saves you the grief it caused us.

Leave a comment

About Jason A. Crome

user-pic Dancer developer, pilot, and hockey player.