Aaron B. Russell's personal blog
3 Oct

I recently tried to use the image_science gem for Ruby, but it didn’t work after installation because it was looking for FreeImage.h. Thinking it’d be an easy fix, I headed over to http://freeimage.sourceforge.net/ to go grab a copy of a binary file to install, but there wasn’t one.
Undeterred, I went to grab the source and compile it myself. It didn’t work. Eventually I figured there were two key issues:
First problem is easy to fix, just replace both instances of /Developer/SDKs/MacOSX10.3.9.sdk with /Developer/SDKs/MacOSX10.6.sdk (or, 10.5 for Leopard, or 10.4u for Tiger).
The second part was a bit more fiddly because I wasn’t sure if order was important, so I started by replacing all instances of i386 and I386 with x86_64 and X86_64 respectively. Then, I replaced all instances of ppc and PPC with i386 and I386.
If you don’t want to worry about making all these changes, you can simply download my Makefile.osx here. It’s built for Snow Leopard, but it’s easy to change it for Leopard or Tiger.
4 Responses for "Compiling FreeImage in 64-bit on Snow Leopard"
thanks very much! this was very helpful indeed :) this way it builds a fat library, that contains both intel archs – i386 and the 64bit _x86_64. i will see, if my 64bit project compiles.
and does this worked at the end?
[...] Compiling FreeImage in 64-bit on Snow Leopard – This was an absolute lifesaver as I had to get an ImageScience-using project cooking on my current dev setup. [...]
It certainly seems to have worked, yeah. I’ve not done much in the way of image related tasks, but all the warnings I was getting upon booting my Rails app have gone away.
Leave a reply