※memorandum
After changing the database to mysql, I got an error when creating an app with Rails.
$ rails _5.2.4_ new app_name --skip-coffee --database=mysql
gem 'pry-rails'
$ bundle install
(abridgement)
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/fengjianlengfu/.rbenv/gems/2.6.0/gems/mysql2-0.5.3 for
inspection.
Results logged to
/Users/fengjianlengfu/.rbenv/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/mysql2-0.5.3/gem_make.out
gem install mysql2 -v '0.5.2'
This person was written, and it was installed without error.
$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"
$ bundle install
・ It seems that this part was the cause.
ld: library not found for -lssl
-The above error occurs when the library called ssl cannot be loaded. → The library does not exist or the connection link to the library is incorrect.
-$ Bundle config --local
is set for the local application.
→ [Reference 1](https://qiita.com/SAYJOY/items/dd7c8fc7a3647e7ff969#%E8%A7%A3%E6%B1%BA%E7%AD%96%E3%81%AB%E3%81%A4 % E3% 81% 84% E3% 81% A6) Reference 2
To be honest, I don't understand why it was solved this way. I would like to look back as I study in the future.
Recommended Posts