またmysqlが入らないエラーが出た

以前OSをアップデートした時にも出現した、mysqlが入らないエラーが再度出現しました。

 以下はエラー文です。 

~/p/r/banken_admin_blog (master|✚1…) [1] $ bundle install

Your Gemfile lists the gem kaminari (>= 0) more than once.

You should probably keep only one of them.

Remove any duplicate entries and specify the gem only once (per group).

While it's not a problem now, it could cause errors if you change the version of one of them later.

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/.........

Using rake 12.3.2

 

 

 

Fetching mysql2 0.5.2

Installing mysql2 0.5.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 

current directory:

/Users/hayashiyoshino/projects/rails-projects/banken_admin_blog/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2/ext/mysql2

/Users/hayashiyoshino/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20190118-42163-dsrvfq.rb

extconf.rb

checking for rb_absint_size()... yes

checking for rb_absint_singlebit_p()... yes

checking for rb_wait_for_single_fd()... yes

-----

Using mysql_config at /usr/local/bin/mysql_config

-----

checking for mysql.h... yes

checking for errmsg.h... yes

checking for SSL_MODE_DISABLED in mysql.h... yes

checking for SSL_MODE_PREFERRED in mysql.h... yes

checking for SSL_MODE_REQUIRED in mysql.h... yes

checking for SSL_MODE_VERIFY_CA in mysql.h... yes

checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes

checking for MYSQL.net.vio in mysql.h... yes

checking for MYSQL.net.pvio in mysql.h... no

checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes

checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes

checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes

checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes

checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes

checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes

checking for my_bool in mysql.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/5.7.21/lib

-----

creating Makefile

 

current directory:

/Users/hayashiyoshino/projects/rails-projects/banken_admin_blog/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2/ext/mysql2

make "DESTDIR=" clean

 

current directory:

/Users/hayashiyoshino/projects/rails-projects/banken_admin_blog/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2/ext/mysql2

make "DESTDIR="

compiling client.c

compiling infile.c

compiling mysql2_ext.c

compiling result.c

compiling statement.c

linking shared-object mysql2/mysql2.bundle

ld: library not found for -lssl

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: *** [mysql2.bundle] Error 1

 

make failed, exit code 2

 

Gem files will remain installed in

/Users/hayashiyoshino/projects/rails-projects/banken_admin_blog/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2

for inspection.

Results logged to

/Users/hayashiyoshino/projects/rails-projects/banken_admin_blog/vendor/bundle/ruby/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/mysql2-0.5.2/gem_make.out

 

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

Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before

bundling.

 

In Gemfile:

  mysql2

 

 

fishに変えたからなのか何なのか、原因がよく分からなかったのでとりあえずもう一度mysqlの設定をしてみました。(意味があったのかは分からない)

 

~ $ ln -sfv /usr/local/opt/mysql\@5.6/*.plist ~/Library/LaunchAgents

/Users/hayashiyoshino/Library/LaunchAgents/homebrew.mxcl.mysql@5.6.plist -> /usr/local/opt/mysql@5.6/homebrew.mxcl.mysql@5.6.plist

~ $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql\@5.6.plist

/usr/local/Cellar/mysql@5.6/5.6.39/homebrew.mxcl.mysql@5.6.plist: service already loaded

 

 

そして~/.config/fish/config.fishにパスを追記します。

~ $ echo 'export PATH="/usr/local/opt/mysql@5.6/bin:$PATH"' >> ~/.config/fish/config.fish

~ $ source ~/.config/fish/config.fish

~ $ which mysql

/usr/local/opt/mysql@5.6/bin/mysql

 

 

 

それでもまだ、bunle install をするとmysql が入ってくれないままだったので、

makeファイルを消しました。

~ $ cd .rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/ext/mysql2/

~/.r/v/2/l/r/g/2/g/m/e/mysql2 $ make clean

~/.r/v/2/l/r/g/2/g/m/e/mysql2 $ cd

~ $ cd projects/rails-projects/banken_admin_blog/

~/p/r/banken_admin_blog (master|✚1…) $

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

You are replacing the current local value of build.mysql2, which is currently nil

 

 

すると無事、mysqlが入ってくれました!!!

~/p/r/banken_admin_blog (master|✚1…) $ bundle install

Your Gemfile lists the gem kaminari (>= 0) more than once.

You should probably keep only one of them.

Remove any duplicate entries and specify the gem only once (per group).

While it's not a problem now, it could cause errors if you change the version of one of them later.

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/.........

Using rake 12.3.2

 

 

Fetching mysql2 0.5.2

Installing mysql2 0.5.2 with native extensions

Fetching pg 0.21.0

Installing pg 0.21.0 with native extensions

Fetching pry 0.12.2

Installing pry 0.12.2

Fetching pry-rails 0.3.9

Installing pry-rails 0.3.9

Fetching puma 3.12.0

Installing puma 3.12.0 with native extensions

Fetching sprockets-rails 3.2.1

Installing sprockets-rails 3.2.1

Fetching rails 5.2.2

Installing rails 5.2.2

Fetching rails_serve_static_assets 0.0.5

Installing rails_serve_static_assets 0.0.5

Fetching rails_stdout_logging 0.0.5

Installing rails_stdout_logging 0.0.5

Fetching rails_12factor 0.0.3

Installing rails_12factor 0.0.3

Fetching ref 2.0.0

Installing ref 2.0.0

Fetching rubyzip 1.2.2

Installing rubyzip 1.2.2

Fetching sass-rails 5.0.7

Installing sass-rails 5.0.7

Fetching selenium-webdriver 3.141.0

Installing selenium-webdriver 3.141.0

Fetching spring 2.0.2

Installing spring 2.0.2

Fetching spring-watcher-listen 2.0.1

Installing spring-watcher-listen 2.0.1

Fetching therubyracer 0.12.3

Installing therubyracer 0.12.3 with native extensions

Fetching turbolinks-source 5.2.0

Installing turbolinks-source 5.2.0

Fetching turbolinks 5.2.0

Installing turbolinks 5.2.0

Fetching twitter-bootstrap-rails 4.0.0

Installing twitter-bootstrap-rails 4.0.0

Fetching uglifier 4.1.20

Installing uglifier 4.1.20

Fetching web-console 3.7.0

Installing web-console 3.7.0

Bundle complete! 31 Gemfile dependencies, 109 gems now installed.

Bundled gems are installed into `./vendor/bundle`

Post-install message from twitter-bootstrap-rails:

Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS.

 

**********************************************

 

ExecJS supports these runtimes:

 

therubyracer - Google V8 embedded within Ruby

 

therubyrhino - Mozilla Rhino embedded within JRuby

 

Node.js

 

Apple JavaScriptCore - Included with Mac OS X

 

Microsoft Windows Script Host (JScript)

 

**********************************************

~/p/r/banken_admin_blog (master|✚1…) $

 

 

色々試しすぎて原因がなにだったのかが特定はできませんでした。。。