Monday, May 9, 2011

How to solve "assembler for architecture ppc not installed" errors after installing XCode4

I was upgrading and building a few Python modules on my Mac this afternoon, and I got this error:

Martin-Kous-MacBook-Pro:~ martinkou$ sudo easy_install -U Cython
Searching for Cython
Best match: Cython 0.14.1
Running Cython-0.14.1/ -q bdist_egg --dist-dir /tmp/easy_install-5NQPRk/Cython-0.14.1/egg-dist-tmp-gOLK4r
warning: manifest_maker:, line 19: 'recursive-include' expects <dir> %lt;pattern1%gt; %lt;pattern2%gt; ...
/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
/tmp/easy_install-5NQPRk/Cython-0.14.1/Cython/Plex/Scanners.c:6694: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/tmp//ccAtkL0J.out (No such file or directory)
error: Setup script exited with error: command 'gcc-4.2' failed with exit status 1

This error pops up for a lot of build scripts besides Python distutil's - Perl modules like ImageMagik are also failing to build on OSX after Xcode4 is installed. The reason for this is Apple has removed the PPC assembler for OSX platforms in Xcode4, yet a lot of existing build scripts for OSX are building universal binaries.

There're quite a few solutions on the Internet, but the cleanest solution I've found so far, is the second solution (as of today) in this Stack Overflow page.

So it turns out Apple has still left a PPC assembler in the iOS platform files for Xcode 4. All you need to do is to make 2 sym links at the appropriate place and it'll work.

$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /Developer/usr/libexec/gcc/darwin
$ sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/libexec/gcc/darwin/ppc /usr/libexec/gcc/darwin


Jeremy Charles said...

Hey Martin... Thanks a bunch for posting this! I've spent about an hour Googling around for answers and have tried a couple that I've found. Your suggestion is the first one I've tried that actually worked.

Enrico Detoma said...

Same for me: your suggestion is the first one that actually worked. Thanks!

Rhys Algar said...

Fantastic, perfect solution. Many Thanks

Todd Berry said...

Thank you so much.

yunpeng said...

Did any one find this doesn't work? on my systems there is no iphone.Platform. So it doesn't work.

David Pardo said...

Worked as a charm. Thank you so much.

Sridhar Sarnobat said...

Thank you very much. I had trouble installing Mailtrends on Mac OS X 10.6 until seeing this post.

send_two said...

Thaks for this mate, worked a treat.

Anonymous said...

For the reason that the admin of this web page is working, no uncertainty very soon it will be well-known, due to its quality

Here is my weblog ... houston garden centers spring tx

Anonymous said...

smokeless cigarettes, smokeless cigarettes, electronic cigarette, smokeless cigarettes, e cigarettes, vapor cigarette

Giải Trí Tổng Hợp said...

Welcomes to google terminal from Austin Texas! google snake
Amazing insight you have on this, Happy wheels it's nice to find a website that details so much information about different artists... Age of war 2 This article always blew me... Earn to die For how many times I have read this.
slither io Hi! I’ve been reading your blog for a while slitherio it's nice to find a website that details so much big farm