跳转到主要内容

提示RMagick过时,请使用rmagick的问题

故障描述

  客户某软件rmagick无法使用;提示: [DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead

故障分析

  无

处理过程

gem list rmagick

*** LOCAL GEMS ***

rmagick (2.16.0)

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

irb
irb(main):001:0> nil
=> nil
irb(main):002:0> puts "defined" if Object.const_defined?(:Magick)
=> nil
irb(main):003:0>  require 'rmagick'
LoadError: libMagickWand-6.Q16.so.2: cannot open shared object file: No such file or directory - /data/ruby/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/RMagick2.so
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /data/ruby/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/rmagick_internal.rb:12:in `<top (required)>'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /data/ruby/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/rmagick.rb:1:in `<top (required)>'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /data/ruby/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from (irb):3
        from /data/ruby/bin/irb:11:in `<main>'

========================提示找不到库文件===========

查找库文件

find / -name libMagickWand-6.Q16.so.2
/usr/local/lib/libMagickWand-6.Q16.so.2

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

ldconfig /usr/local/lib

irb
irb(main):001:0> puts "defined" if Object.const_defined?(:Magick)
=> nil
irb(main):002:0> require 'rmagick'
=> true
irb(main):003:0> puts "defined" if Object.const_defined?(:Magick)
defined
=> nil
irb(main):004:0> quit

=================问题解决。

建议/总结

  无