我正在尝试安装一个使用mysql2 gem的开源rails 3.2.21应用程序,但是当我尝试运行bundle通信时,我得到了以下错误:
Fetching: mysql2-0.3.18.gem (100%)
Building native extensions. This could take a while...
p
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/my_username/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20150614-72129-orqsb7.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql/5.6.25/lib
-----
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
linking shared-object mysql2/mysql2.bundle
ld: warning: directory not found for option '-L/Users/travis/.sm/pkg/active/lib'
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/my_username/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/gems/mysql2-0.3.18 for inspection.
Results logged to /Users/my_username/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/extensions/x86我尝试卸载我通过自制软件安装的每个版本的mysql,然后重新安装,如下所示:
brew uninstall --force mysql && brew install mysql然后运行:
sudo gem install mysql2正如这里提出的一些类似问题所暗示的,但它仍然会导致与上面相同的错误。
有没有人能就如何启动和运行提供一些指导?
发布于 2019-03-15 23:46:57
试试这个:
gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include(根据需要更新版本)
发布于 2016-10-30 18:30:38
我的解决方案是安装Xcode命令行工具。
我最近通过Mac应用商店更新了Xcode,每次更新时,我都发现我必须再次重新安装命令行工具。
xcode-select --install发布于 2019-06-19 04:15:33
基于解决方案here
brew install openssl
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/解决了这个问题。
https://stackoverflow.com/questions/30834421
复制相似问题