– we create awesome web applications

In the process of installing Mephisto I’ve got a problem with image_science gem.

It installed OK but when trying to require it the was a problem with RubyInline compilation:

astrails@alpha:~$ irb
irb(main):001:0> astrails@alpha:~$ irb -rrubygems -rimage_science
/home/astrails/.ruby_inline/Inline_ImageScience_aa58.c:3:23:
error: FreeImage.h: No such file or directory
...
CompilationError: error executing gcc -shared   -fPIC -Wall -g -fno-strict-aliasing -O2  -fPIC -I /usr/lib/ruby/1.8/x86_64-   linux -I /usr/include -o "/home/astrails/.ruby_inline/Inline_ImageScience_aa58.so" "/home/astrails/.ruby_inline/Inline_ImageScience_aa58.c" -lfreeimage -lstdc++: 256
...

RubyInline is a ruby gem that allows you to write inline C code in your ruby source files and it will be compiled and linked-in when it is first used. This requires gcc and all build dependencies to be installed on the computer running it (which kind of sucks if you want to use it on an embedded device, but thats for another post)

Anyway, in this case FreeImage.h was missing which is part of FreeImage project.

Lets get it back.

Unfortunately ‘freeimage’ Debian package is not available in the stable Etch distribution.

The solution is to compile source package from Lenny:

Edit your /etc/apt/sources.list file and add the following line to it:

deb-src http://http.us.debian.org/debian lenny main non-free contrib

Install ‘tofrodos’ (This is freeimage’s build dependency):

apt-get install tofrodos

Download and build source packages for freeimage:

mkdir /tmp/freeimage
cd /tmp/freeimage/
apt-get source -b freeimage

“-b” flag tells apt-get to build the package after it downloads the sources.

Install the packages

dpkg -i *.deb

Test image_science

irb -rrubygems -rimage_science