Image science breakage – SystemExit

Image Science is a small plugin that does just the stuff you need from RMagick, without all the weight that RMagick brings with it. It uses FreeImage to do the manipulations. (By the way, the MacPorts installation of that completely failed on my Leopard Mac, I advise you compile it by hand.)I was getting these kind of errors from my dev site:

SystemExit (exit):
/usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:70:in `exit'
/usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:70:in `rootdir'
/usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:84:in `directory'
/usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:258:in `so_name'
/usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:294:in `load_cache'
/usr/local/lib/ruby/gems/1.8/gems/RubyInline-3.6.5/lib/inline.rb:678:in `inline'
/usr/local/lib/ruby/gems/1.8/gems/image_science-1.1.3/lib/image_science.rb:84

Not nice. Curiously everything worked fine on the production system. A bit of digging in the code was required. Image Science uses a gem called RubyInline to allow it to compile and install C extensions to Ruby on the fly. And RubyInline places these extensions in a directory called “.ruby_inline”. It chooses this directory from either the environment setting INLINEDIR, or if that isn’t set then HOME.And there is the problem – my dev system was running as apache which does not have a home directory.I added this kind of code:

if RAILS_ENV == "development"?? ENV['INLINEDIR'] = RAILS_ROOT + "/tmp"end

And I made sure that tmp in my rails dir was writeable by apache (but do not make it world writable, that won’t work either).

Advertisements

2 thoughts on “Image science breakage – SystemExit

  1. Hy,thank you for your research… This ENV[‘INLINEDIR’] saved my afternoon. I was wishing this bug to hell… till I found your site.Keep up the good work!Lukas

  2. […] – RubyInline saved by m52008-12-14 – Image science breakage – SystemExit saved by malexander12192008-12-14 – Sazima Network Lauch! saved by nmrmusic2008-10-15 – java_inline […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s