1
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 3 years have passed since last update.

RMagick4.1.2インストール時に発生したエラーの対応

Last updated at Posted at 2020-10-29

問題

RMagick4.1.2インストール時にエラーが発生。エラーを取り除き、インストールしたい。

結論

ImageMagickが6.9.10だったので7.0.10に上げたらインストールできた。

やったこと

# gem install rmagick -v '4.1.2'

Building native extensions. This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/rmagick-4.1.2/ext/RMagick
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.6.0 -r ./siteconf20201029-30239-189vtpy.rb extconf.rb
checking for brew... no
checking for pacman... no
checking for Ruby version >= 2.3.0... yes
checking for pkg-config... no


ERROR: Can't install RMagick 4.1.2. Can't find pkg-config in /usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ここでエラーが発生していた。
以下はバージョン情報。

# ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]

# apt list
imagemagick-6-common/stable,stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 all [installed,automatic]
imagemagick-6-doc/stable,stable 8:6.9.10.23+dfsg-2.1+deb10u1 all
imagemagick-6.q16/stable,stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 amd64 [installed,automatic]
imagemagick-6.q16hdri/stable,stable 8:6.9.10.23+dfsg-2.1+deb10u1 amd64
imagemagick-common/stable,stable 8:6.9.10.23+dfsg-2.1+deb10u1 all
imagemagick-doc/stable,stable 8:6.9.10.23+dfsg-2.1+deb10u1 all
imagemagick/stable,stable,now 8:6.9.10.23+dfsg-2.1+deb10u1 amd64 [installed]

既に似たようなIssueがあった

LoadError:dlopen(/Library/Ruby/Gems/2.6.0/gems/rmagick-4.1.2/lib/RMagick2.bundle, 0x0009) · Issue #1247 · rmagick/rmagick · GitHub

ImageMagick7をインストールする

# apt remove imagemagick
# sudo apt update 
# sudo apt-get install build-essential
# wget https://www.imagemagick.org/download/ImageMagick.tar.gz
# tar xvzf ImageMagick.tar.gz
# cd ImageMagick-7.0.10-34/
# ./configure 
# make
# make install 

# ランタイムリンクの設定
# ldconfig /usr/local/lib

# 確認
# magick -version
Version: ImageMagick 7.0.10-34 Q16 x86_64 2020-10-29 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5) 
Delegates (built-in): bzlib djvu fontconfig freetype jbig jng jp2 jpeg lcms lqr lzma openexr png tiff x xml zlib

RMagickが入るかテスト

# gem install rmagick -v '4.1.2'
Building native extensions. This could take a while...
Successfully installed rmagick-4.1.2
1 gem installed

やったね。

追記

ERROR: Can't install RMagick 4.2.2. Can't find pkg-config

4.2.2の場合には以下も必要でした。

apt install -y libmagick++-dev
1
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
1
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?