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

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

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

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

Q&A

解決済

1回答

5376閲覧

An error occurred while installing mysql2 (0.3.21), and Bundler cannot continue.

ayachika

総合スコア36

Ruby on Rails

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

0グッド

1クリップ

投稿2019/08/03 06:29

編集2019/08/03 06:36

現在複数の人で開発しているサービスに途中から参加しまして、かつmacを使うのが初めてなので四苦八苦している者です。

今回、bundle installをしたところ、下記エラーに遭遇しました。

(ちなみに、bundlerのバージョンはプロジェクトのGemfileに記載のあるバージョンと同じ物を指定しました。
その後、bundle installをすると、Gemfile中のライブラリとのバージョンが合わなかったため、一度Gemfile.lockを削除した後でのbundle installです。)

##エラー内容

$ bundle install --path vendor/bundle The git source `git://github.com/smartinez87/exception_notification.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure. Fetching git://github.com/smartinez87/exception_notification.git Fetching gem metadata from https://rubygems.org/........ Fetching gem metadata from https://rubygems.org/. Resolving dependencies.................. Using rake 12.3.3 Using concurrent-ruby 1.1.5 Using i18n 0.9.5 Using json 1.8.6 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 4.2.0 Using builder 3.2.3 Using erubis 2.7.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.3 Using rails-deprecated_sanitizer 1.0.3 Using rails-dom-testing 1.0.9 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.0.4 Using actionview 4.2.0 Using rack 1.6.11 Using rack-test 0.6.3 Using actionpack 4.2.0 Using globalid 0.4.2 Using activejob 4.2.0 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 4.2.0 Using activemodel 4.2.0 Using arel 6.0.4 Using activerecord 4.2.0 Using acts-as-taggable-on 3.5.0 Using public_suffix 3.1.1 Using addressable 2.6.0 Using net-ssh 5.2.0 Using net-scp 2.0.0 Using sshkit 1.19.1 Using airbrussh 1.3.2 Using apns 1.0.0 Using debug_inspector 0.0.3 Using binding_of_caller 0.8.0 Using buftok 0.2.0 Using bundler 1.17.3 Using byebug 11.0.1 Using cancancan 1.17.0 Using capistrano 3.11.0 Using capistrano-bundler 1.6.0 Using capistrano-rails 1.4.0 Using capistrano-rbenv 2.1.4 Using connection_pool 2.2.2 Using rack-protection 1.5.5 Using redis 4.1.2 Using sidekiq 5.2.7 Using capistrano-sidekiq 1.0.2 Using nio4r 2.4.0 Using puma 4.0.1 Using capistrano3-puma 4.0.0 Using choice 0.2.0 Using chronic 0.10.2 Using coderay 1.1.2 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using thor 0.20.3 Using railties 4.2.0 Using coffee-rails 4.0.1 Using commonjs 0.2.7 Using unf_ext 0.0.7.6 Using unf 0.1.4 Using domain_name 0.5.20190701 Using domainatrix 0.0.11 Using request_store 1.4.1 Using draper 2.1.0 Using equalizer 0.0.11 Using temple 0.8.1 Using tilt 1.4.1 Using haml 5.1.1 Using sexp_processor 4.12.1 Using ruby_parser 3.13.1 Using html2haml 2.2.0 Using erb2haml 0.1.5 Using exception_notification 4.3.0 from git://github.com/smartinez87/exception_notification.git (at master@6a89f3b) Using factory_girl 4.9.0 Using factory_girl_rails 4.9.0 Using faker 2.1.0 Using multipart-post 2.1.1 Using faraday 0.15.4 Using http-cookie 1.0.3 Using faraday-cookie_jar 0.0.6 Using faraday-encoding 0.0.5 Using faraday-http-cache 2.0.0 Using faraday_middleware 0.13.1 Using fastimage 2.1.5 Using ffaker 2.1.0 Using font-awesome-rails 4.7.0.5 Using multi_json 1.13.1 Using gon 6.2.1 Using hamlit 2.9.3 Using hamlit-rails 0.2.3 Using hashie 3.6.0 Using hike 1.2.3 Using http-form_data 2.1.1 Using http_parser.rb 0.6.0 Using http 3.3.0 Using jbuilder 2.9.1 Using jquery-rails 4.3.5 Using jquery-ui-rails 6.0.1 Using jwt 2.2.1 Using kaminari-core 1.1.1 Using kaminari-actionview 1.1.1 Using kaminari-activerecord 1.1.1 Using kaminari 1.1.1 Using koala 2.5.0 Using less 2.6.0 Using sprockets 2.12.5 Using less-rails 4.0.0 Using libv8 3.16.14.19 (x86_64-darwin-18) Using memoizable 0.4.2 Using meta-tags 2.11.1 Using nesty 1.0.2 Using metainspector 5.6.0 Using method_source 0.9.2 Using mime-types-data 3.2019.0331 Using mime-types 3.2.2 Using multi_xml 0.6.0 Fetching mysql2 0.3.21 Installing mysql2 0.3.21 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/user/myprojects/project/vendor/bundle/ruby/2.3.0/gems/mysql2-0.3.21/ext/mysql2 /Users/user/.rbenv/versions/2.3.0/bin/ruby -I /Users/user/.rbenv/versions/2.3.0/lib/ruby/site_ruby/2.3.0 -r ./siteconf20190803-38482-ey8hd5.rb extconf.rb 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 ----- Using mysql_config at /usr/local/bin/mysql_config ----- checking for mysql.h... yes checking for errmsg.h... yes checking for mysqld_error.h... yes ----- Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load ----- ----- Setting libpath to /usr/local/Cellar/mysql/8.0.16/lib ----- creating Makefile current directory: /Users/user/myprojects/project/vendor/bundle/ruby/2.3.0/gems/mysql2-0.3.21/ext/mysql2 make "DESTDIR=" clean current directory: /Users/user/myprojects/project/vendor/bundle/ruby/2.3.0/gems/mysql2-0.3.21/ext/mysql2 make "DESTDIR=" compiling infile.c compiling client.c client.c:439:3: error: use of undeclared identifier 'my_bool' my_bool res = mysql_read_query_result(client); ^ client.c:441:19: error: use of undeclared identifier 'res' return (void *)(res == 0 ? Qtrue : Qfalse); ^ client.c:762:3: error: use of undeclared identifier 'my_bool' my_bool boolval; ^ client.c:793:7: error: use of undeclared identifier 'boolval' boolval = (value == Qfalse ? 0 : 1); ^ client.c:794:17: error: use of undeclared identifier 'boolval' retval = &boolval; ^ client.c:797:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'? case MYSQL_SECURE_AUTH: ^~~~~~~~~~~~~~~~~ MYSQL_DEFAULT_AUTH /usr/local/Cellar/mysql/8.0.16/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here MYSQL_DEFAULT_AUTH, ^ client.c:798:7: error: use of undeclared identifier 'boolval' boolval = (value == Qfalse ? 0 : 1); ^ client.c:799:17: error: use of undeclared identifier 'boolval' retval = &boolval; ^ client.c:830:38: error: use of undeclared identifier 'boolval' wrapper->reconnect_enabled = boolval; ^ client.c:1185:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'? return _mysql_client_options(self, MYSQL_SECURE_AUTH, value); ^~~~~~~~~~~~~~~~~ MYSQL_DEFAULT_AUTH /usr/local/Cellar/mysql/8.0.16/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here MYSQL_DEFAULT_AUTH, ^ 10 errors generated. make: *** [client.o] Error 1 make failed, exit code 2 Gem files will remain installed in /Users/user/myprojects/project/vendor/bundle/ruby/2.3.0/gems/mysql2-0.3.21 for inspection. Results logged to /Users/user/myprojects/project/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-18/2.3.0-static/mysql2-0.3.21/gem_make.out An error occurred while installing mysql2 (0.3.21), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.21' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2

##試したこと

上記エラーにある通り、

gem install mysql2 -v '0.3.21' --source 'https://rubygems.org/

を試してみましたが、

$ gem install mysql2 -v '0.3.21' --source ERROR: While executing gem ... (OptionParser::MissingArgument) missing argument: --source usernoMacBook-Air:project user$ 'https://rubygems.org/

という表示が出てこれ以上先に進みません。
検索してもあまり似たような事例がなく解決に時間がかかりそうだったので、質問させていただきました。

どなたか解決方法をご存知の方がいればご教示いただけると幸いです。

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

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

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

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

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

guest

回答1

0

ベストアンサー

以下の記事と同じ現象ではないでしょうか。

RailsプロジェクトでMySQLがbundle installできなかった
https://qiita.com/akito19/items/e1dc54f907987e688cc0

コマンド

$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"

投稿2019/08/03 08:20

nskydiving

総合スコア6500

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

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

ayachika

2019/08/03 09:16

nskydiving様 ご教示ありがとうございます。無事、先に進むことができました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問