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:
- FreeImage’s source was prepared for Mac OS X 10.3 (Panther)
- FreeImage was trying to compile for i386 (32-bit) and my Ruby install is x86-64 (64-bit)
First problem is easy to fix, just replace both instances of
/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
X86_64 respectively. Then, I replaced all instances of
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.