前提・実現したいこと
前提
Ruby on Rails6にてアプリを作成
AWS インスタンス作成
EC2にログイン
EC2インスタンス内の環境構築が完了
GitHubクローン完了
実現したいこと
本番環境でgemを管理するためのbundlerをインストールしたい
発生している問題・エラーメッセージ
ターミナル Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
ターミナル An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2
該当するソースコード
ターミナル [ec2-user@ip-********** Dr_nishi]$ gem install bundler -v 2.1.4 Fetching: bundler-2.1.4.gem (100%) Successfully installed bundler-2.1.4 Parsing documentation for bundler-2.1.4 Installing ri documentation for bundler-2.1.4 Done installing documentation for bundler after 4 seconds 1 gem installed [ec2-user@ip-*********** Dr_nishi]$ bundle 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 rake 13.0.1 Installing rake 13.0.1 Fetching concurrent-ruby 1.1.7 Installing concurrent-ruby 1.1.7 Fetching i18n 1.8.5 Installing i18n 1.8.5 Fetching minitest 5.14.2 Installing minitest 5.14.2 Fetching thread_safe 0.3.6 Installing thread_safe 0.3.6 Fetching tzinfo 1.2.8 Installing tzinfo 1.2.8 Fetching zeitwerk 2.4.1 Installing zeitwerk 2.4.1 Fetching activesupport 6.0.3.4 Installing activesupport 6.0.3.4 Fetching builder 3.2.4 Installing builder 3.2.4 Fetching erubi 1.9.0 Installing erubi 1.9.0 Fetching mini_portile2 2.4.0 Installing mini_portile2 2.4.0 Fetching nokogiri 1.10.10 Installing nokogiri 1.10.10 with native extensions Fetching rails-dom-testing 2.0.3 Installing rails-dom-testing 2.0.3 Fetching crass 1.0.6 Installing crass 1.0.6 Fetching loofah 2.7.0 Installing loofah 2.7.0 Fetching rails-html-sanitizer 1.3.0 Installing rails-html-sanitizer 1.3.0 Fetching actionview 6.0.3.4 Installing actionview 6.0.3.4 Fetching rack 2.2.3 Installing rack 2.2.3 Fetching rack-test 1.1.0 Installing rack-test 1.1.0 Fetching actionpack 6.0.3.4 Installing actionpack 6.0.3.4 Fetching nio4r 2.5.4 Installing nio4r 2.5.4 with native extensions Fetching websocket-extensions 0.1.5 Installing websocket-extensions 0.1.5 Fetching websocket-driver 0.7.3 Installing websocket-driver 0.7.3 with native extensions Fetching actioncable 6.0.3.4 Installing actioncable 6.0.3.4 Fetching globalid 0.4.2 Installing globalid 0.4.2 Fetching activejob 6.0.3.4 Installing activejob 6.0.3.4 Fetching activemodel 6.0.3.4 Installing activemodel 6.0.3.4 Fetching activerecord 6.0.3.4 Installing activerecord 6.0.3.4 Fetching mimemagic 0.3.5 Installing mimemagic 0.3.5 Fetching marcel 0.3.3 Installing marcel 0.3.3 Fetching activestorage 6.0.3.4 Installing activestorage 6.0.3.4 Fetching mini_mime 1.0.2 Installing mini_mime 1.0.2 Fetching mail 2.7.1 Installing mail 2.7.1 Fetching actionmailbox 6.0.3.4 Installing actionmailbox 6.0.3.4 Fetching actionmailer 6.0.3.4 Installing actionmailer 6.0.3.4 Fetching actiontext 6.0.3.4 Installing actiontext 6.0.3.4 Fetching public_suffix 4.0.6 Installing public_suffix 4.0.6 Fetching addressable 2.7.0 Installing addressable 2.7.0 Fetching bcrypt 3.1.16 Installing bcrypt 3.1.16 with native extensions Fetching bindex 0.8.1 Installing bindex 0.8.1 with native extensions Fetching msgpack 1.3.3 Installing msgpack 1.3.3 with native extensions Fetching bootsnap 1.5.0 Installing bootsnap 1.5.0 with native extensions Fetching thor 1.0.1 Installing thor 1.0.1 Fetching bourbon 7.0.0 Installing bourbon 7.0.0 Using bundler 2.1.4 Fetching byebug 11.1.3 Installing byebug 11.1.3 with native extensions Fetching regexp_parser 1.8.2 Installing regexp_parser 1.8.2 Fetching xpath 3.2.0 Installing xpath 3.2.0 Fetching capybara 3.33.0 Installing capybara 3.33.0 Fetching childprocess 3.0.0 Installing childprocess 3.0.0 Fetching orm_adapter 0.5.0 Installing orm_adapter 0.5.0 Fetching method_source 1.0.0 Installing method_source 1.0.0 Fetching railties 6.0.3.4 Installing railties 6.0.3.4 Fetching responders 3.0.1 Installing responders 3.0.1 Fetching warden 1.2.9 Installing warden 1.2.9 Fetching devise 4.7.3 Installing devise 4.7.3 Fetching erubis 2.7.0 Installing erubis 2.7.0 Fetching ffi 1.13.1 Installing ffi 1.13.1 with native extensions Fetching sassc 2.4.0 Installing sassc 2.4.0 with native extensions Fetching font-awesome-sass 5.15.1 Installing font-awesome-sass 5.15.1 Fetching temple 0.8.2 Installing temple 0.8.2 Fetching tilt 2.0.10 Installing tilt 2.0.10 Fetching haml 5.2.0 Installing haml 5.2.0 Fetching sexp_processor 4.15.1 Installing sexp_processor 4.15.1 Fetching ruby_parser 3.15.0 Installing ruby_parser 3.15.0 Fetching html2haml 2.2.0 Installing html2haml 2.2.0 Fetching haml-rails 2.0.1 Installing haml-rails 2.0.1 Fetching mini_magick 4.11.0 Installing mini_magick 4.11.0 Fetching ruby-vips 2.0.17 Installing ruby-vips 2.0.17 Fetching image_processing 1.12.1 Installing image_processing 1.12.1 Fetching jbuilder 2.10.1 Installing jbuilder 2.10.1 Fetching jquery-rails 4.4.0 Installing jquery-rails 4.4.0 Fetching kgio 2.11.3 Installing kgio 2.11.3 with native extensions Fetching rb-fsevent 0.10.4 Installing rb-fsevent 0.10.4 Fetching rb-inotify 0.10.1 Installing rb-inotify 0.10.1 Fetching listen 3.2.1 Installing listen 3.2.1 Fetching mysql2 0.4.10 Installing mysql2 0.4.10 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10/ext/mysql2 /home/ec2-user/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20201122-25816-mmmq6h.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... no checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for rb_big_cmp()... yes checking for mysql_query() in -lmysqlclient... no ----- mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again. ----- *** 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/.rbenv/versions/2.5.1/bin/$(RUBY_BASE_NAME) --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/mysql2-0.4.10/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10 for inspection. Results logged to /home/ec2-user/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0/mysql2-0.4.10/gem_make.out An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2
gemfile.lock RUBY VERSION ruby 2.5.1p57 BUNDLED WITH 2.1.4
試したこと(仮説)
エラー内容で検索行い以下のリンクを参照にしました。
リンク内容
リンク内容
参照しましたが解決策がわかりませんでした。
補足
初心者で言葉足らずで申し訳ありませんがご教示頂けたらと思い質問させて頂きました。
宜しくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/11/22 05:48