おなじみのmysqlで失敗するので備忘録
OS: macOS mojave
Ruby: 2.6.0
...
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/corocn/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/mysql2-0.5.2 for inspection.
Results logged to /Users/corocn/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/mysql2-0.5.2/gem_make.out
OpenSSL周りが原因っぽい
以下試してエラー
https://qiita.com/akito19/items/e1dc54f907987e688cc0
ログ見たら --with-cppflags オプションに対応してないとのこと。
ldflagsのみで実行してみる
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"
bundle install
通った