10
votes

UPDATE:

gem install rmagick solved the problem.

=====================================

After upgrading my ubuntu to 12.10 when I run my rails application it gives an error

libMagickCore.so.4: cannot open shared object file: No such file or directory - /home/pramod/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.2/lib/RMagick2.so

below path exists in my system.

/home/pramod/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.2/lib/RMagick2.so

I'm new to linux and don't have much idea on how to solve it. Any help is much appreciated.

5

5 Answers

22
votes

When you upgrade you can lose the reference to library file in a compiled gem. To resolve this just recompile the gem (the rmagick gem in this case). Depending on your server setup you can do this with gem pristine rmagick or bundle exec gem pristine rmagick when using bundler.

7
votes

Add the following to .bashrc any try again

export LD_LIBRARY_PATH=/usr/local/lib

if, the above command does not work means the install ImageMagick to configured with rmagick. Try,

   gem uninstall rmagick
   gem install rmagick
3
votes

This worked for me (although also tried export and gem reinstall solutions, which might have also helped, but didn't do the complete job...):

ldconfig /usr/local/lib
1
votes

I had the same issue, upgrading to version 2.15.3 worked for me

0
votes

In my case I had all the native libraries installed under vendor/bundle, because we use bundle install --deployment on our servers.

In this setup neither gem pristine rmagick nor gem uninstall rmagick; gem install vendor/cache/rmagick-<version>.gem helped.

I had to remove vendor/bundle and do a bundle install --deployment again rm -r vendor/bundle; bundle install --deployment.

These commands should be run from the root directory of the rails application.