2

I run Apache2 with Phusion Passenger (installed from gem) with Ruby 1.8 on Debian 6. It gives me the following LoadError:

libMagickCore.so.4: cannot open shared object file: No such file or directory - /var/myapp/rmagick/ruby/1.8/gems/rmagick-2.13.1/lib/RMagick2.so

Yet the file exists and is readable + executable for everyone, including Apache. When I copy the path from the error message and paste it into the command line, I can find it (e.g. with ls). So it clearly exists in the exact right path that it claims it can't be found!

What am I missing here?

Thanks, MrB

EDIT: Solved!

The problem wasn't that RMagick2.so wasn't found, the libMagickCore.so.4 wasn't found. This was due to the wrong version of Rmagick2.so being used. After fidgeting around with ImageMagick and RMagick versions for an hour, it now works.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
MrB
  • 21
  • 2
  • 1
    If you solve your own problem post it as an answer and then accept it later. This helps anyone else who might have a similar problem in the future. – ChrisF Jun 09 '11 at 10:44
  • 5
    Defining "fidgeting around" would be very very helpful. Because now I'm in the same situation, and I have no idea what "fidgeting around" actually means. Guess that means I get to open up a new question. – VxJasonxV Mar 13 '12 at 01:05

3 Answers3

2

The problem wasn't that RMagick2.so wasn't found, the libMagickCore.so.4 wasn't found. This was due to the wrong version of Rmagick2.so being used. After fidgeting around with ImageMagick and RMagick versions for an hour, it now works.

Aaron
  • 2,968
  • 1
  • 23
  • 36
1

I had the same problem on my rails app. I fixed it by changing the requested version of the gem 'rmagick'. Since I was already using the latest version (4.1.2 at this time), I changed my Gemfile.lock to request 4.1.1 and rerun bundle install. That was it.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
jibai31
  • 111
  • 2
0

I found a cleaner way. The problem was that the gem was compiled with an old dependency. When running bundle install, as the gem was found, there was no need to recompile it. Removing the compiled gem forces bundle install to recompile it, this time with the proper dependencies.

Based on the path in your question, you can run:

rm -rf /var/myapp/rmagick/ruby/1.8/gems/rmagick-*
rm /var/myapp/rmagick/ruby/1.8/specifications/rmagick-*

Then run bundle install.

jibai31
  • 111
  • 2