首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试使用mysql2 gem安装应用程序时出错

问尝试使用mysql2 gem安装应用程序时出错
EN

Stack Overflow用户
提问于 2015-06-15 04:53:04
回答 11查看 36.1K关注 0票数 95

我正在尝试安装一个使用mysql2 gem的开源rails 3.2.21应用程序,但是当我尝试运行bundle通信时,我得到了以下错误:

代码语言:javascript
复制
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,然后重新安装,如下所示:

代码语言:javascript
复制
brew uninstall --force mysql && brew install mysql

然后运行:

代码语言:javascript
复制
sudo gem install mysql2

正如这里提出的一些类似问题所暗示的,但它仍然会导致与上面相同的错误。

有没有人能就如何启动和运行提供一些指导?

EN

回答 11

Stack Overflow用户

发布于 2019-03-15 23:46:57

试试这个:

代码语言:javascript
复制
gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include

(根据需要更新版本)

票数 44
EN

Stack Overflow用户

发布于 2016-10-30 18:30:38

我的解决方案是安装Xcode命令行工具。

我最近通过Mac应用商店更新了Xcode,每次更新时,我都发现我必须再次重新安装命令行工具。

代码语言:javascript
复制
xcode-select --install
票数 36
EN

Stack Overflow用户

发布于 2019-06-19 04:15:33

基于解决方案here

代码语言:javascript
复制
brew install openssl

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

解决了这个问题。

票数 32
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30834421

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档