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

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

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

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

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

Ruby on Rails

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

Q&A

解決済

1回答

752閲覧

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

doichek

総合スコア27

Cloud9

Cloud9は、クラウドからのプログラミングが可能になるWebサービス。IDEとしての機能が搭載されており、GitHubやHerokuなど他ツールとの連携も可能です。ブラウザ上で動くため、デバイスに関係なく開発環境を準備できます。

Ruby

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

Ruby on Rails

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

0グッド

0クリップ

投稿2020/11/30 06:34

前提・実現したいこと

プロフィール編集画面にて、画像アップロード機能を実装しようとしています。
以下のページを参考にしています。
https://pg-happy.jp/carrierwave-rmagic-uploader.html

CarrierWaveをインストールして画像アップロード自体はできるようにはなりました。
次にアップロードした画像のサイズやファイル名を加工できるようにrmagickのインストールを進めようとしていますが、エラーが発生してインストールができません。
事前に「sudo yum -y install ImageMagick ImageMagick-devel」のコマンドでImageMagickのインストールは完了しています。

発生している問題・エラーメッセージ

Gemfileに「gem 'rmagick'」と記述してbandle installすると以下が表示されインストールできません。

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 13.0.1 Using concurrent-ruby 1.1.7 Using i18n 1.8.5 Using minitest 5.14.2 Using thread_safe 0.3.6 Using tzinfo 1.2.7 Using activesupport 5.2.4.4 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.10 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.7.0 Using rails-html-sanitizer 1.3.0 Using actionview 5.2.4.4 Using rack 2.2.3 Using rack-test 1.1.0 Using actionpack 5.2.4.4 Using nio4r 2.5.4 Using websocket-extensions 0.1.5 Using websocket-driver 0.7.3 Using actioncable 5.2.4.4 Using globalid 0.4.2 Using activejob 5.2.4.4 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 5.2.4.4 Using activemodel 5.2.4.4 Using arel 9.0.0 Using activerecord 5.2.4.4 Using mimemagic 0.3.5 Using marcel 0.3.3 Using activestorage 5.2.4.4 Using public_suffix 4.0.6 Using addressable 2.7.0 Using bcrypt 3.1.15 Using bindex 0.8.1 Using msgpack 1.3.3 Using bootsnap 1.5.0 Using bundler 1.17.3 Using byebug 11.1.3 Using mini_magick 4.11.0 Using ffi 1.13.1 Using ruby-vips 2.0.17 Using image_processing 1.12.1 Using carrierwave 2.1.0 Using coderay 1.1.3 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 1.0.0 Using thor 1.0.1 Using railties 5.2.4.4 Using coffee-rails 4.2.2 Using jbuilder 2.10.1 Using kaminari-core 1.2.1 Using kaminari-actionview 1.2.1 Using kaminari-activerecord 1.2.1 Using kaminari 1.2.1 Using rb-fsevent 0.10.4 Using rb-inotify 0.10.1 Using ruby_dep 1.5.0 Using listen 3.1.5 Using mysql2 0.5.3 Using pry 0.13.1 Using pry-byebug 3.9.0 Using puma 3.12.6 Using sprockets 3.7.2 Using sprockets-rails 3.2.2 Using rails 5.2.4.4 Fetching rmagick 4.1.2 Installing rmagick 4.1.2 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/rmagick-4.1.2/ext/RMagick /home/ec2-user/.rvm/rubies/ruby-2.5.3/bin/ruby -I /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0 -r ./siteconf20201130-10526-1qb8hip.rb extconf.rb checking for brew... no checking for pacman... no checking for Ruby version >= 2.3.0... yes checking for pkg-config... yes checking for outdated ImageMagick version (<= 6.7.7)... no checking for gcc... yes checking for __GNUC__... *** 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/ec2-user/.rvm/rubies/ruby-2.5.3/bin/$(RUBY_BASE_NAME) /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:523:in `with_werror' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:841:in `macro_defined?' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:983:in `block in have_macro' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:948:in `block in checking_for' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:320:in `open' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:320:in `open' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:346:in `postpone' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:947:in `checking_for' from /home/ec2-user/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/mkmf.rb:982:in `have_macro' from extconf.rb:99:in `configure_compile_options' from extconf.rb:19:in `initialize' from extconf.rb:395:in `new' from extconf.rb:395:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/ec2-user/.rvm/gems/ruby-2.5.3/extensions/x86_64-linux/2.5.0/rmagick-4.1.2/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.5.3/gems/rmagick-4.1.2 for inspection. Results logged to /home/ec2-user/.rvm/gems/ruby-2.5.3/extensions/x86_64-linux/2.5.0/rmagick-4.1.2/gem_make.out An error occurred while installing rmagick (4.1.2), and Bundler cannot continue. Make sure that `gem install rmagick -v '4.1.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rmagick

試したこと

「convert -version」コマンドで以下が表示されたのでimagemagickはインストールできていると考えています。

Version: ImageMagick 6.9.10-68 Q16 x86_64 2020-04-10 https://imagemagick.org Copyright: © 1999-2019 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC Modules OpenMP(3.1) Delegates (built-in): bzlib fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps tiff wmf x xml zlib

他サイトで「PKG_CONFIG」のインストールも必要とあったので「apt install build-essential pkg-config libmagicwand-dev」のコマンドを試したところ以下が表示されました。

apt: invalid flag: install Usage: apt <apt and javac options> <source files> where apt options include: -classpath <path> Specify where to find user class files and annotation processor factories -cp <path> Specify where to find user class files and annotation processor factories -d <path> Specify where to place processor and javac generated class files -s <path> Specify where to place processor generated source files -source <release> Provide source compatibility with specified release -version Version information -help Print a synopsis of standard options; use javac -help for more options -X Print a synopsis of nonstandard options -J<flag> Pass <flag> directly to the runtime system -A[key[=value]] Options to pass to annotation processors -nocompile Do not compile source files to class files -print Print out textual representation of specified types -factorypath <path> Specify where to find annotation processor factories -factory <class> Name of AnnotationProcessorFactory to use; bypasses default discovery process See javac -help for information on javac options. warning: The apt tool and its associated API are planned to be removed in the next major JDK release. These features have been superseded by javac and the standardized annotation processing API, javax.annotation.processing and javax.lang.model. Users are recommended to migrate to the annotation processing features of javac; see the javac man page for more information.

補足情報(FW/ツールのバージョンなど)

環境:cloud9

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

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

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

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

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

doichek

2020/12/01 07:34

回答ありがとうございます。 サイトを確認してみましたが、環境変数の項目がわかりませんでした。 (何をどのように設定したらよいかなど。) 別のサイトでも色々調べて乗っているコマンドを色々試しましたが、エラーが表示されたり、コマンドを拒否されたりでした。 自分の環境は[apt-get]は使えず[yum]のコマンドを使うということがわかったくらいの初心者なのでどなたか丁寧にご教示頂けないでしょうか。
guest

回答1

0

自己解決

rmagickでの対応は諦め、minimagickで対応しました。

投稿2020/12/14 04:23

doichek

総合スコア27

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問