title: Installing PIL on OS X Lion: initialization from incompatible pointer type
body: <p>I want to run python's <a href="http://docs.scipy.org/doc/scipy-0.7.x/reference/tutorial/ndimage.html" rel="nofollow noreferrer">ndimage</a> to do some image analysis. I have a 64-bit Mac running OSX Lion and Python 2.7.  When I tried to run commands from <code>ndimage</code> commands I found out that I need to install PIL.</p>
  
  <p>I downloaded that and unzipped it (for now into the downloads folder, is there a better place to do it?).  I run setup.py and get these messages:</p>
  
  <pre><code>running install
  running build
  running build_py
  running build_ext
  --- using frameworks at /System/Library/Frameworks
  building '_imaging' extension
  gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.6-intel-2.7/_imaging.o
  unable to execute gcc-4.2: No such file or directory
  error: command 'gcc-4.2' failed with exit status 1
  </code></pre>
  
  <p>I read <a href="https://stackoverflow.com/questions/7473896/failed-to-build-pil-on-mac-os-x-10-7-lion">Failed to build PIL on Mac OS X 10.7 Lion</a> and made sure that I have the 32/64 bit version of python 2.7 installed (Mac OS X 64-bit/32-bit x86-64/i386 Installer (2.7.2) for Mac OS X 10.6 and 10.7 ).  I also have Xcode installed.  Am I doing something stupid here? </p>
  
  <p><strong>Edit 1:</strong>
  looking further, I have found this <a href="https://stackoverflow.com/questions/8473066/gcc-4-2-failed-with-exit-status-1">gcc-4.2 failed with exit status 1</a>.  I've tried entering this when I get the error:</p>
  
  <pre><code>llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.6-intel-2.7/_imaging.o
  </code></pre>
  
  <p>and I get these messages:</p>
  
  <pre><code>_imaging.c:3017: warning: initialization from incompatible pointer type
  _imaging.c:3077: warning: initialization from incompatible pointer type
  _imaging.c:3017: warning: initialization from incompatible pointer type
  _imaging.c:3077: warning: initialization from incompatible pointer type
  </code></pre>
  
  <p><strong>Edit 2:</strong>
  I'm not sure if this is the right way to go, but I found a <a href="http://passingcuriosity.com/2009/installing-pil-on-mac-os-x-leopard/" rel="nofollow noreferrer">post on installing pil on OSX Leopard</a> and, following its advice, got rid of the <code>-arch i386</code> part of the command and entered:</p>
  
  <pre><code> llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.6-intel-2.7/_imaging.o
  </code></pre>
  
  <p>Now I only get two errors:</p>
  
  <pre><code>_imaging.c:3017: warning: initialization from incompatible pointer type
  _imaging.c:3077: warning: initialization from incompatible pointer type
  </code></pre>
  
  <p>From what I can tell at this point the program poops out and doesn't finish compiling. Can anyone help me take it from here?</p>