Python 2.6.1, pycrypto 2.3 pypi package: "Broken Pipe" during build

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.


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.