Tuesday, June 29, 2010

Getting PIL to work well on Snow Leopard

I was trying to update my environment and ran into some linker problems. It turns out that PIL was not working well. My Python is 64 bit, the python that my environment was trying to use was i386 and ppc. I have not been building ppc files. I found a few great references out there.
Universal Binaries on Mac Ports was the best. Modifying your varients.conf file to include:
+universal
Gets you half of the way. If you need ppc support under a 64 bit Intel setup, you need to add them manually into macports.conf:
# machine architectures
universal_archs x86_64 i386
Changes to:
# machine architectures
universal_archs x86_64 i386 ppc
Save these two files and then rebuild. In this case, I was rebuilding a PIL dependency jpeg. I also found out I had to add a few more dependencies for linking to be happy:
sudo port upgrade --force jpeg
sudo port install zlib
sudo port install freetype 
The "--force" made sure to stomp over the existing compile even though other things depended on it. As mentioned in the article referenced at the top, the way to nuke and rebuild everything is by running "sudo port upgrade --force installed". I do not recommend this unless you need to or have a lot of time on your hands. It will all be rebuilt. :)

Hope this helps someone. If it does, please let me know.

Jacob

No comments: