Tips December 9, 2007 at 10:43 pm

CPAN and mod_perl on Leopard

In migrating one of our servers from 10.4 to 10.5, we run into a couple of problems, some of which were easily solved, some we're still working on. In particular, this issue regarded using the RT ticket tracking system from Best Practical. It's not the prettiest, but it's good and inexpensive and works nicely on Macs (thanks to MacPorts).

Unfortunately, as we were trying to get our system moved to Apache2, we noticed that the perl code we were using was aborting when it called libraries loaded up with CPAN. After a bit of work trying to figure it out, we determined that the problem is that Apache2 runs as a 64-bit binary and the mod_perl is therefore also compiled as 64-bit. If you're running on a 32-bit G4 or a Core Solo or Core Duo (but not Core 2) intel, this isn't going to be a problem. However, if you're running on a 64-bit CPU (Core 2 or G5), this requires that all loadable perl modules also be compiled for 64-bit. Unfortunately, CPAN on the Mac compiles all modules for 2-way universal, PowerPC and x86, but just the 32-bit variations.

In order to get these modules working on a 64-bit machine, you'll need to make sure that all your CPAN modules are compiled with the 64-bit architectures as well. This is as simple as adding the ARCHFLAGS to have all 4 architectures when executing CPAN.


setenv ARCHFLAGS '-arch i386 -arch ppc -arch ppc64 -arch x86_64'

Do this before executing your cpan installs and you'll be all set.

Leave a reply

You must be logged in to post a comment.