It turns out that by default (at least on SL) Macports only builds a x86_64 binaries. Running the
file command shows it’s only one architecture, something like:
[berto@bolt]$ file /opt/local/lib/libpcrecpp.dylib /opt/local/lib/libpcrecpp.dylib: Mach-O 64-bit dynamically linked shared library x86_64
SL’s Python2.5 isn’t even built for x86_64, which is the reason PIL blows up in Python2.5:
[berto@bolt]$ file /usr/bin/python2.5 /usr/bin/python2.5: Mach-O universal binary with 2 architectures /usr/bin/python2.5 (for architecture i386): Mach-O executable i386 /usr/bin/python2.5 (for architecture ppc7400): Mach-O executable ppc
The solution is to tell Macports to build universal binaries. This can be done by adding
+universal to the command line, for example:
sudo port install jpeg +universal
A more general solution is to add this “variant” to the Macports config. Simply add
+universal to the file
/opt/local/etc/macports/variants.conf. The file is read-only, even for root, so make sure to force-write the file (:wq! in vi).
And if you want to rebuild everything universal, sledgehammer approach:
sudo port upgrade --force installed
More info from Tim:
Note that the architectures it picks might not be what you want. On Leopard Intel it appears to do i386 x86_64. If you want ppc, set ‘universal_archs ppc i386 ppc64 x86_64′ (note NO EQUALS).
Rebuilding all is the command you wanted, or for just the specific ones
needed, ‘sudo port upgrade –enforce-variants curl’ should do it to add
+universal (it won’t rebuild when you change universal_archs though).
Once Macports is universal, rebuilding and installing PIL works like a charm!