【问题标题】:Install mysql2 gem on macos在 macOS 上安装 mysql2 gem
【发布时间】:2021-11-15 13:54:02
【问题描述】:

我正在尝试在 Mac 上安装 mysql2,默认情况下我的 openssl 位于 /opt/homebrew/opt/openssl@1.1/bin/openssl

我用LDFLAGS & CPPFLAGS使用命令安装了mysql2:

sudo gem install mysql2 -v '0.5.3' -- \
  --with-ldflags=-L/opt/homebrew/opt/openssl@1.1/lib \
  --with-cppflags=-I/opt/homebrew/opt/openssl@1.1/include

但它导致了一个错误:

   2 warnings generated.
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1

make failed, exit code 2

我尝试了几种方法,但都无法解决问题。

【问题讨论】:

    标签: openssl mysql2


    【解决方案1】:

    哦,终于,我在here 找到了一个解决方案,它对我很有用

    rbenv exec gem install mysql2 -- \
    --with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.26/lib \
    --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.26 \
    --with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.26/bin/mysql_config \
    --with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.26/include 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-29
      • 2012-08-07
      • 2014-02-03
      • 1970-01-01
      • 2014-08-21
      • 2013-10-01
      • 2021-12-23
      相关资源
      最近更新 更多