libdpstk.so.1: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so

what

突然、以下のエラーが出始めた。今まで出なかったのに・・・。

# rake
(in /home/bar/fuga)
rake aborted!
libdpstk.so.1: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so

(See full trace by running task with --trace)


なんぞこれ・・・orz


エラーを詳しく見る

# rake --trace
(in /rails/fuga)
** Invoke default (first_time)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
libdpstk.so.1: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.rb:11
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
/home/livep395/rixi/config/../config/environment.rb:98
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/misc.rake:3
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:369:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `send'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:368:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:361:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:369:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `send'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:368:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:361:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/testing.rake:45
/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/testing.rake:43:in `collect'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/testing.rake:43
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:369:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `send'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:368:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:361:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7
/usr/bin/rake:16:in `load'
/usr/bin/rake:16


/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.rb:11

↑ここをみると

require 'RMagick.so'

となっていて、これがエラーする。


つまり、以下が解決できればいい。

# irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'RMagick.so'
LoadError: no such file to load -- RMagick.so
       from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
       from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
       from (irb):3
irb(main):004:0>

これが、

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'RMagick.so'
=> true

こうなるようにしよう。


RMagickの Install FAQ を見てみる

http://rmagick.rubyforge.org/install-faq.html#loaderror
↑ここが一番あやしいけど、

export LD_LIBRARY_PATH=/usr/local/lib

やってもだめ・・・・orz



ImageMagick と RMagick を再インストール

色々調べた結果・・・分からず・・・orz
もう・・・再インストールしかない・・・。

  • RMagick のアンインストール
# gem uninstall rmagick
# rpm -qa | grep ImageMagick
ImageMagick-perl-6.0.7.1-16
ImageMagick-devel-6.0.7.1-16
ImageMagick-6.0.7.1-16
# rpm -e ImageMagick-perl-6.0.7.1-16
# rpm -e ImageMagick-devel-6.0.7.1-16
# rpm -e ImageMagick-6.0.7.1-16
# rpm -qa | grep ImageMagick
#
# yum install ImageMagick
# yum install ImageMagick-devel
# yum install ghostscript*
  • RMagick インストール
# gem install RMagick -v 1.13.0
Need to update 1 gems from http://gems.rubyforge.org
.
complete
Building native extensions.  This could take a while...
Successfully installed rmagick-1.13.0

おおおおおおぉ、ちゃんと入った!

# rpm -qa | grep ImageMagick
ImageMagick-devel-6.0.7.1-16
ImageMagick-6.0.7.1-16
# gem list | grep rmagick
rmagick (1.13.0)

ImageMagick-perl-6.0.7.1-16 はいまのところ必要ないのでインストールはしませんでした。

  • ちゃんと require できるか確認する
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'RMagick.so'
=> true


できましたー。

しかし、根本的な原因が分からず・・・。
なぜ、とつぜん動かなくなるのか・・・。

つっこみ歓迎です。

環境

# ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]