安装mysql2(0.5.3)时出错,Bundler无法继续

问题描述 投票:0回答:3

我使用的是 apple M1 mac os 12.1 我已经用命令成功安装了mysql2

gem install mysql2 -v '0.5.3' -- \
--with-mysql-lib=/opt/homebrew/Cellar/mysql/8.0.28/lib \
--with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.28 \
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.28/bin/mysql_config \
--with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.28/include

Successfully installed mysql2-0.5.3
Parsing documentation for mysql2-0.5.3
Done installing documentation for mysql2 after 0 seconds
1 gem installed

运行时

bundle install
我仍然收到错误

linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/opt/homebrew/Cellar/mysql/8.0.28/lib --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.0.28
--with-mysql-config=/opt/homebrew/Cellar/mysql/8.0.28/bin/mysql_config --with-mysql-include=/opt/homebrew/Cellar/mysql/8.0.28/include'
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

安装mysql2(0.5.3)时出错,Bundler无法继续。 捆绑前请确保

gem install mysql2 -v '0.5.3'
成功。

mysql ruby-on-rails bundle
3个回答
2
投票

我在 M1 mac 上遇到了同样的错误,并尝试了下面的命令。

$ brew install openssl
$ echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
$ source ~/.zshrc
$ bundle config --local build.mysql2 "--with-ldflags=-L/opt/homebrew/opt/[email protected]/lib"
$ export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/Cellar/zstd/1.5.2/lib:/opt/homebrew/Cellar/[email protected]/1.1.1m/lib/

github


0
投票

安装如下:

sudo apt-get install libmysqlclient-dev

sudo yum install mysql-devel

-1
投票

运行此命令:-

$ sudo apt-get install default-libmysqlclient-dev

© www.soinside.com 2019 - 2024. All rights reserved.