LoginSignup
9
6

More than 5 years have passed since last update.

mysqlのbundle installに失敗する

Posted at

おなじみの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

通った :tada:

9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6