6
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

mysqlのbundle installに失敗する

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
6
Help us understand the problem. What are the problem?