The basic problem

It's fairly well known that many of the Perl modules on CPAN have little bits of C in them, and so one needs a C tool chain to build them. On MacOS that means installing Xcode, and version 4 of Xcode is now available in the Mac App Store.

In fact, given a new Mac running MacOS 10.6.7, Xcode 4 was one of the first things I installed. Imagine my surprise when it proved impossible to install Text::CSV_XS—not the most popular module I know, but still representative:

...
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler
    (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as)
for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386

Although it looks confusing at first, the error message is actually quite explicit: no ppc (PowerPC) assembler could be found I assume Apple have removed it in Xcode 4.

I don't care about PPC support per se, but it does become a problem if it breaks the other architectures. Happily, a solution is at hand.

A short-term fix

The key variable which governs which architectures get built is $archflags which is defined in /System/Library/Perl/5.10.0/darwin-thread-multi-2level/Config_heavy.pl

Simply edit this file and change

$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386 -arch ppc';

into

$archflags = exists($ENV{ARCHFLAGS}) ? $ENV{ARCHFLAGS} : '-arch x86_64 -arch i386';

Presumably one could do something similar by manipulating the ARCHFLAGS environment variable, but that seemed rather fragile to me.

A proper solution

At some point I'm sure Apple will either fix Xcode or Perl.