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

hgqdbh6s  于 2023-10-15  发布在  Mysql
关注(0)|答案(3)|浏览(180)

我在苹果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'成功。

wribegjk

wribegjk1#

安装如下:

sudo apt-get install libmysqlclient-dev

sudo yum install mysql-devel
1u4esq0p

1u4esq0p2#

运行此命令:-

$ sudo apt-get install default-libmysqlclient-dev

pcrecxhr

pcrecxhr3#

我在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

相关问题