Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

mysqlのbundle installに失敗する

More than 1 year has passed since last update.

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

corocn
Ruby / AWS / GCP / 認証認可 記事は基本的に技術ブログに書いてます。Qiitaはメモ的な使い方。
http://blog.corocn.jp/
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