iprog.com

Compiling mod_xsendfile for OS X

Today I needed to compile mod_xsendfile for OS X on Intel. The standard command for this,

apxs -cia mod_xsendfile.c

resulted in a module that was for i386 only.

Apache on Leopard (untested on Tiger) doesn’t appreciate this, throwing this error:

4/7/08 5:08:08 PM org.apache.httpd[ 15990] httpd: Syntax error on line 116 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_xsendfile.so into server: dlopen(/usr/libexec/apache2/mod_xsendfile.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_xsendfile.so: mach-o, but wrong architecture

Turns out the solution is pretty simple. Just change the command to apxs to this:

apxs -cia -Wc,"-arch x86_64 -arch ppc -arch i386 -arch ppc64" -Wl,"-arch x86_64 -arch ppc -arch i386 -arch ppc64" mod_xsendfile.c

This will generate a fat-binary for all four current Mac architectures.

11 comments

spotlight fun in leopard

i upgraded to mac os x 10.5 shortly after it came out. one of the biggest areas of improvement is with spotlight. mostly it’s just much, much faster.

given its speed, i often use spotlight to launch less frequently used applications. today i went to launch locomotive.

cmd-space – l – o – c – o

that’s as far as i got before locomotive was the top hit, ready to launch. that’s great. more amusing, however, was what was right below it:

definition: adjective. crazy.

made me smile.

0 comments