EGOPOLY

Topics include: programming, Apple, Unix, gadgets, large-scale web sites and other nerdy stuff.

How to install tomcat mod_jk on Mac OS X Leopard

2007-10-29 17:21:26

You'd think this would be easy, but you'd be wrong. I was.

First, the config files have moved. They are not in /etc/httpd anymore. They are in /etc/apache2. Great. But that was the easy part.

I followed similar instructions to my previous method for Tiger, but if you do that, you get this in your system.log when you restart Apache:

/private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/modjk.so into server: dlopen(/usr/libexec/apache2/modjk.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_jk.so: mach-o, but wrong architecture

I checked the architecture of the mod_jk.so. It said i386. Whaa??? An Intel Mac won't load an i386 file in Leopard? (Sad face here). OK, fine, all I have to do is is compile with gcc with the right flags. What are those?

-arch x86_64

But that's not the whole deal, because I use apxs to do the compiling, so you actually have to hack up the Makefile.apxs magic line. In particular, after you generate Makefile.apxs, edit it like this:

modjk.la: $(APXS) -c -o $@ -Wc,"${APXSCFLAGS} -arch x8664 ${JKINCL}" "${JAVAINCL}" "${APXSLDFLAGS} -arch x8664 " modjk.c ${APACHE_OBJECTS}

Then your apache should at least load, and you can configure the rest.