質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

2回答

3311閲覧

rmagickがインストールできない

maruineko

総合スコア12

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

1クリップ

投稿2020/03/28 03:34

railsアプリに画像アップロード機能を付けたのですが、スマートデバイスからアップロードした画像が90度回転してしまう現象が起きています。
exif情報を操作してこの問題を解消したいと思い、rmagickのgemを導入しようとしているのですが、インストールができません。

gem "rmagick"
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rmagick-4.1.0/ext/RMagick /home/user/.rbenv/versions/2.6.5/bin/ruby -I /home/user/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200328-29183-ms5zol.rb extconf.rb checking for brew... no checking for pacman... no checking for Ruby version >= 2.3.0... yes checking for pkg-config... yes Package MagickCore was not found in the pkg-config search path. Perhaps you should add the directory containing `MagickCore.pc' to the PKG_CONFIG_PATH environment variable Package 'MagickCore', required by 'virtual:world', not found ERROR: Can't install RMagick 4.1.0. 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=/home/user/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME) To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/rmagick-4.1.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rmagick-4.1.0 for inspection. Results logged to /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/rmagick-4.1.0/gem_make.out An error occurred while installing rmagick (4.1.0), and Bundler cannot continue. Make sure that `gem install rmagick -v '4.1.0' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rmagick

上記のエラーが出たので、「gem install rmagick -v '4.1.0' --source 'https://rubygems.org/'」を実行すると、

Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. current directory: /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rmagick-4.1.0/ext/RMagick /home/user/.rbenv/versions/2.6.5/bin/ruby -I /home/user/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200328-29244-1kajxcf.rb extconf.rb checking for brew... no checking for pacman... no checking for Ruby version >= 2.3.0... yes checking for pkg-config... yes Package MagickCore was not found in the pkg-config search path. Perhaps you should add the directory containing `MagickCore.pc' to the PKG_CONFIG_PATH environment variable Package 'MagickCore', required by 'virtual:world', not found ERROR: Can't install RMagick 4.1.0. 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=/home/user/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME) To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/rmagick-4.1.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rmagick-4.1.0 for inspection. Results logged to /home/user/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/rmagick-4.1.0/gem_make.out

とエラーが出ました。
対処法を教えてください。
また、centosでパッケージが必要かと思いますが、centos8のパッケージ(dnf)が見つかりません。
そのあたりもご存じであればご教授ください。

####バージョン
rails 6.0.2.1
ruby 2.6.5
CentOS 8

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ベストアンサー

Can't find the ImageMagick library or one of the dependent libraries.

と出ているので、ImageMagick本体が見つけられないか、依存性のライブラリが足りていないと思われます。もし、それらのインストールがされているのなら、パスがきちんと通っていないのではないでしょうか?

投稿2020/03/28 04:47

s_eric

総合スコア184

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

「dnf imagemagick」で検索すると、centos8ではGraphicsMagickになっているようですね。
rmagickではGraphicsMagickには現在対応していなかった筈ですので
ImageMagickをソースからインストールするか
rmagickの代わりにminimagickを使うかを選ぶ事になります。

投稿2020/03/28 09:55

asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問