de-co-de: Apache Tomcat connector - mach-o, but wrong architecture

Posted on August 01, 2008 in Fix-it

If you install the connector yourself on OS X 10.5 intel you may get the following error.
httpd: Syntax error on line 484 of /private/etc/apache2/httpd.conf: Syntax error on line 3 of /private/etc/apache2/other/mod_jk.conf: \
Cannot load /usr/libexec/apache2/ into server: \
dlopen(/usr/libexec/apache2/, 10): no suitable image found.\
Did find:\n\t\
/usr/libexec/apache2/ mach-o, but wrong architecture

This error is because apache is compiled as a 64 bit executable and configure builds a 32 bit shared library

You have to re-do the configure with

./configure CFLAGS='-arch x86_64' APXSLDFLAGS='-arch x86_64' --with-apxs=/usr/sbin/apxs
sudo make install