Developer talk follows. XCode 4 removes the PowerPC compiler, breaking package installers that try to build universal libraries.

When building most Python packages that incorporate native code, setup fails with an error like the following:
> pip install keyring
    /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
    keyring/backends/osx_keychain.c:117: fatal error: error writing to -: Broken pipe
    compilation terminated.
    lipo: can't open input file: /var/tmp//cdXmPvrV.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1

That was from pip, but distutils, setuptools, easy_install, and "python install" should all fail with a similar error.

To fix it, tell the compiler explicitly not to bother with PowerPC. Prefix the build or installation command line with this:

ARCHFLAGS="-arch i386 -arch x86_64"
If the install command needs to start with sudo, insert the above bit of text immediately afterwards, like this:
sudo ARCHFLAGS="-arch i386 -arch x86_64" pip install keyring
If installation doesn’t need sudo (for instance, installing into a virtualenv), you can enter the following command line once and the effect will last across multiple builds or installations for the remainder of the terminal session.
export ARCHFLAGS="-arch i386 -arch x86_64"
blog comments powered by Disqus