Recently Apple released Xcode 4 - their development IDE and toolkit and which is the easiest way to install a compiler on an OSX machine.
Two things are different about this release - firstly that unless you're on Lion (OSX 10.7) Xcode is not free (the reasons for this are todo with somewhat odd accounting laws). Secondly it doesn't have a PPC assembler target.
This may not seem like a problem if you're running on an Intel based Mac - afterall Intel based Macs were announced at WWDC in 2005 and all PowerPC based Macs were discontinued in 2006 - apart from the fact that the system Perl is compiled with "-arch ppc" flags (presumably to accommodate Apple's Universal Binary system which allowed applications to run on both PPC and Intel based machines without recompilation) which means that any XS based CPAN modules which required a compiler would fail to build, let alone install.
There are three solutions to this:
- Downgrade your Xcode to 3.x - by looking at the "Optional Application" folder on the OSX system install disc or by spelunking through the Apple developers' web site you can find an old version which will make things work again. This isn't a long term solution however.
- Install XS modules by hand - in a extracted copy of the distribution try something like
eval $(perl -V:ccflags); perl Makefile.PL CCFLAGS="$(echo "$ccflags" | sed 's/-arch ppc//')" && make && make testalthough, again, this is clearly a suboptimal solution.
- Modify your Perl config - as described here on Martin Oldfield's blog you can edit
System/Library/Perl/5.10.0/darwin-thread-mto remove the
- Stop using the system Perl. To be honest this is probably good advice anyway - the vendor probably expects the system Perl to stay constant anyway (for example OSX uses Perl in its boot process) and upgrading its modules may cause unforeseen problems. And if there's anything that the RedHat / Perl 5.8 debacle taught us is that you shouldn't trust the system Perl anyway. By far the easiest way to do this is to install Perlbrew which has the added bonus that it allows you to switch between different versions of Perl very quickly - ideal for checking your code works consistently.
Arguably this is an Apple bug but it's unlikely they'll fix it quickly, if at all so it's best to take a proactive approach. And installing Perlbrew really is easy.
EDIT: Added Martin Oldfield's Config_heavy.pl hack