0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rmagickのインストールに失敗する場合

Last updated at Posted at 2013-08-23

エラー内容

yamada-no-MacBook-Air:hoge yamada$ bundle exec rails s
/Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/rmagick-2.13.2/lib/RMagick2.bundle, 9): Library not loaded: /opt/local/lib/libMagickCore.6.dylib (LoadError)
  Referenced from: /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/rmagick-2.13.2/lib/RMagick2.bundle
  Reason: Incompatible library version: RMagick2.bundle requires version 7.0.0 or later, but libMagickCore.6.dylib provides version 2.0.0 - /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/rmagick-2.13.2/lib/RMagick2.bundle
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `block in require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/rmagick-2.13.2/lib/rmagick.rb:11:in `<top (required)>'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
  from /Users/yamada/work/workstation/config/application.rb:7:in `<top (required)>'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.9/lib/rails/commands.rb:53:in `block in <top (required)>'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
  from /Users/yamada/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.9/lib/rails/commands.rb:50:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

原因

以下のコマンドでportをアップグレードしたのが原因だった。

$ sudo port -d selfupdate
$ sudo port upgrade outdated

対処法

sudo port uninstall ImageMagick
sudo port install ImageMagick

gem uninstall rmagick

ワーキングディレクトリに移動して

bundle install

これで解決した。

追記

と思ったら再度失敗。

今度は普通に

Installing rmagick (2.13.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/ito/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/ito/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
	--with-MagickCorelib
	--without-MagickCorelib
	--with-Magicklib
	--without-Magicklib
	--with-Magick++lib
	--without-Magick++lib


Gem files will remain installed in /Users/ito/.rvm/gems/ruby-1.9.3-p286/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/ito/.rvm/gems/ruby-1.9.3-p286/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

An error occurred while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.

とのこと

を参考に

cd /opt/local/lib
sudo ln -s libMagick++-6.Q16.dylib libMagick++.dylib
sudo ln -s libMagickCore-6.Q16.dylib libMagickCore.dylib
sudo ln -s libMagickWand-6.Q16.dylib libMagickWand.dylib

とやって解決。

そもそもrmagick 2.13.2はインストールできていたのでそちらにしろということか。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?