我在 Sonoma 14.3.1 上安装 mysql2 时遇到问题。 我已经通过brew安装了MySQL,以及openssl(OpenSSL 3.3.0 9 Apr 2024)和zstd(Zstandard CLI 64位v1.5.6)库。 还安装了X-code(版本:15.3.0.0.1.1708646388)。但是当我尝试安装 mysql2 时,我最终遇到错误并且不知道如何修复它。
我输入命令:
gem install mysql2 -- --with-mysql-lib=/usr/local/Cellar/mysql/8.3.0_1/lib --with-mysql-dir=/usr/local/Cellar/mysql/8.3.0_1 --with-mysql-config=/usr/local/Cellar/mysql/8.3.0_1/bin/mysql_config --with-mysql-include=/usr/local/Cellar/mysql/8.3.0_1/include
错误信息如下:
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_gc_mark_movable()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... no
-----
Cannot find library dir(s) /AppleInternal/Library/BuildRoots/4e1473ee-9f66-11ee-8daf-cedaeb4cabe2/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.3.Internal.sdk/usr/local/libressl-by-deployment-target/13.0/lib
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.
据我所知,Xcode libressl 库文件夹或其标头有问题。
有什么想法吗?预先感谢您。
(在安装和捆绑 gem mysql2 时面临类似的问题,并有一个简单的问题):当我运行相同的命令时( gem install mysql2 -- --with-mysql-lib=/opt/homebrew/Cellar/mysql/8.3.0_1/lib --with-mysql-dir=/opt/homebrew/Cellar/mysql/8.3.0_1 --with-mysql-config=/opt/homebrew/Cellar/mysql/8.3.0_1/bin/mysql_config --with-mysql- include=/opt/homebrew/Cellar/mysql/8.3.0_1/include )我看到以下消息:
这可能需要一段时间... 成功安装mysql2-0.5.6 内部:/Users/USERABC/.rvm/rubies/ruby-3.3.0/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:127:在`require'中:链接到不兼容的/System/Library/Frameworks /Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib - /Users/USERABC/.rvm/gems/ruby-3.3.0@proctorserv/gems/date-3.3.4/lib/date_core.bundle (加载错误)
并且捆绑失败,并显示与您相同的错误消息。你的反应也一样吗^?或者你的 gem 安装正确了吗?