LoginSignup
0
0

More than 1 year has passed since last update.

【Rails】An error occurred while installing rmagick (2.16.0), and Bundler cannot continue.

Last updated at Posted at 2022-04-07

環境

windows11

Rails 6.0.4.1
rmagick 2.16.0

症状

rmagicをGemに記載した後、「bundle install」を実行したときに、下記のエラーメッセージが表示されました。 翻訳すると、「rmagick(2.16.0)のインストール中にエラーが発生し、Bundlerを続行できません。」でした。
error
$ bundle install

(中略)

Fetching rmagick 2.16.0
Installing rmagick 2.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rmagick-2.16.0/ext/RMagick
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/3.0.0 -r
./siteconf20220406-63964-z6t4vr.rb extconf.rb 
*** 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=C:/Ruby30-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in ``': No such file or directory - identify -version
(Errno::ENOENT)
        from extconf.rb:141:in `configure_compile_options'
        from extconf.rb:16:in `initialize'    
        from extconf.rb:548:in `new'
        from extconf.rb:548:in `<main>'       

extconf failed, exit code 1

Gem files will remain installed in
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/rmagick-2.16.0 for inspection.
Results logged to
C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/rmagick-2.16.0/gem_make.out  

  C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/builder.rb:91:in `run'
C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:48:in `block in
build'
  C:/Ruby30-x64/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:28:in `build'
  C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/builder.rb:157:in `build_extension'
C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/builder.rb:191:in `block in
build_extensions'
  C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/builder.rb:188:in `each'
  C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/ext/builder.rb:188:in `build_extensions'
  C:/Ruby30-x64/lib/ruby/3.0.0/rubygems/installer.rb:828:in `build_extensions'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/rubygems_gem_installer.rb:66:in
`build_extensions'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/rubygems_gem_installer.rb:26:in
`install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/source/rubygems.rb:192:in 
`install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/gem_installer.rb:54:in
`install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:171:in
`install_serially'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:97:in
`call'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:71:in
`call'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer.rb:263:in       
`install_in_parallel'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer.rb:210:in       
`install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer.rb:90:in        
`block in run'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/process_lock.rb:12:in     
`block in lock'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/process_lock.rb:9:in      
`open'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/process_lock.rb:9:in      
`lock'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer.rb:72:in        
`run'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer.rb:24:in        
`install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/cli/install.rb:60:in      
`run'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/cli.rb:252:in
`block in install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/settings.rb:131:in        
`temporary'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/cli.rb:251:in
`install'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/vendor/thor/lib/thor/command.rb:27:in
`run'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in
`invoke_command'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/vendor/thor/lib/thor.rb:392:in
`dispatch'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/cli.rb:31:in
`dispatch'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/vendor/thor/lib/thor/base.rb:485:in
`start'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/cli.rb:25:in
`start'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/exe/bundle:49:in `block
in <top (required)>'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/friendly_errors.rb:128:in 
`with_friendly_errors'
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/exe/bundle:37:in `<top
(required)>'
  C:/Ruby30-x64/bin/bundle:23:in `load'       
  C:/Ruby30-x64/bin/bundle:23:in `<main>'     

An error occurred while installing rmagick (2.16.0), and Bundler cannot
continue.

In Gemfile:
  rmagick

解決策

ImageMagickを入れることで解決しました。

まずは、ImageMagickをいれていきます。
rmagickは新しめの7バージョンのものがうまく対応されてないようなので、6バージョンのものを入れる必要があります。
下記サイトから入れました。
自分の環境はwindowsなので、OSに合ったものを選びます。

入っていることをバージョン確認で確認しました。

バージョン確認
$convert --version  
Version: ImageMagick 6.9.12-44 Q16-HDRI x64 b350dd1:20220327 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Visual C++: 193131104
Features: Cipher DPC HDRI Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raqm raw rsvg tiff webp xml zlib

詳細な手順は下記に書きました

参考

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