Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am attempting to install Fabric, which requires pycrypto. During the build for pycrypto I always receive a "Broken Pipe" error. I don't know where to start to fix the problem.

I'm running Mac OS X Snow Leopard 10.6.6, all updates installed; Python 2.6.1; GCC 4.2; XCode 4 (in case that updated GCC)

The exact error is:

$ sudo python setup.py build
Password:
running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -fwrapv -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.6-universal-2.6/src/MD2.o
/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
src/MD2.c:134: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/tmp//ccfADoXD.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
share|improve this question
1  
Well, the problem is that it's trying to build a PPC binary. In the gcc line, it has "-arch ppc", which would be causing it. No idea how to fix it though. –  Tony Arkles Mar 20 '11 at 20:15
add comment

3 Answers

up vote 15 down vote accepted

This is a better solution that works for all Python C extension building on ALL Python versions on Mac OS X 10.6 using XCode 4.

ARCHFLAGS="-arch i386 -arch x86_64" python setup.py build

This way you don't have to muck around with the setup.py files for all the C extensions you are trying to build.

share|improve this answer
    
Thankyou so much. What an obscure problem! –  Chris Mar 29 '11 at 23:33
    
Excellent, thanks, stuck this into my ~/.zshrc. –  xorbyte Mar 30 '11 at 18:21
    
Make sure you sudo this –  Jon May 10 '11 at 19:05
    
@Jon. That depends. You can install Python packages locally on your own home directory. –  Y.H Wong May 22 '11 at 12:18
add comment

Another option is to copy back the ppc assemblers from a previous version of xcode. You only have to copy the folders ppc and ppc64 from the location /usr/libexec/gcc/darwin/

I recognize that's also a terrible workaround, but it did work for me!

share|improve this answer
add comment

As Tony pointed out the issue is PPC related. XCode 4 removed the PPC assembler. Setup tools tries to install for all architectures by default, i386, ppc and x86_64.

I added this code to my pycrypto-2.3 setup.py in line 122 and following. This searches the set compiler options for 'ppc' and removes it and the predecessing '-arch' instruction'.

    # removing PPC flag from compiler options
    index = self.compiler.compiler_so.index('ppc')

    del self.compiler.compiler_so[index]
    del self.compiler.compiler_so[index-1]

Running the usual sudo python setup.py install on the modified file installed pycrypto without a problem.

This is a terrible workaround, but should work for now until setuptools can better detect that 10.6 with XCode 4 no longer has PPC as an applicable target architecture. Suggestions to fix this problem over all are accepted.

share|improve this answer
    
There's a better solution. The hint can be found under /System/Frameworks/Python.framework/Versions/VERSION/lib/PYTHON_VERSION/distutil‌​s/sysconfig.py:customize_compiler –  Y.H Wong Mar 22 '11 at 6:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.