8

I'm trying to install PIL on an Intel Mac OS X Leopard machine. Unfortunately, "setup.py build" thinks it should be compiling for ppc.

gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/sw/include -I/opt/local/include -I/Users/adam/Development/pinax-env/include -I/usr/local/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c libImaging/GifEncode.c -o build/temp.macosx-10.3-i386-2.5/libImaging/GifEncode.o

This fails because I don't have the ppc arch files available on my machine (nor do I want to install them). How can I tell setup.py to only do i386?

I've looked in /Library/Frameworks/Python.framework for a config file to no avail.

Adam Nelson
  • 7,932
  • 11
  • 44
  • 64

2 Answers2

19

The solution that worked for me was:

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

Just pass the values for the flag right in the command line.

Mel
  • 959
  • 11
  • 19
2

The easiest solution (for a single or a few C files) is to copy the compiler line, edit it, and invoke it manually, then run setup.py again - it should notice that this step was already done.

To make setup.py not use these options anymore, you need to change the Makefile in Python's config directory, and remove the options.

Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235
  • What Makefile did you edit? What python binary are you using? – Martin v. Löwis Aug 04 '09 at 22:28
  • 1
    Got it. Info at the bottom of this page: http://wiki.python.org/moin/MacPython/UniversalLibrariesAndExtensions /Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/config/Makefile I had tried just 'copying and pasting' the offending gcc - which is what didn't work. The Makefile needed to be changed in the end. – Adam Nelson Aug 05 '09 at 18:18
  • 3
    The system is set up to source `/System/Library/Frameworks/Python.framework/Versions/x.y/lib/pythonx.y/distutils/sysconfig.py` (where x.y is your python version). ARCHFLAGS is the supported override, and if you want to remove `-arch ppc` for all builds, remove it from your sysconfig.py file. Mel Walker’s answer is the correct one. – cbowns Jul 14 '11 at 00:35