首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装mysql2 gem失败

安装mysql2 gem失败
EN

Stack Overflow用户
提问于 2014-09-11 01:55:51
回答 2查看 277关注 0票数 0

我正在尝试在新的Mavericks机器上建立一个不是很老(但仍有几年)的Rails项目。当我尝试bundle时,我一直收到这个错误(很抱歉代码很长):

代码语言:javascript
复制
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/royzinn/.rbenv/versions/1.8.7-p352/bin/ruby extconf.rb --with-mysql-config=/usr/local/Cellar/mysql/5.5.20/bin/mysql_config
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/royzinn/.rbenv/versions/1.8.7-p352/bin/ruby
    --with-mysql-config


Gem files will remain installed in /Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18 for     inspection.
Results logged to /Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18/ext/mysql2/gem_make.out

在此之前,我收到一条消息,告诉我gem是为MySQL版本5.5.20构建的,并且我已经激活了其他(更高级的) MySQL。

我用Homebrew“清理”了所有东西,尝试重新安装,但似乎什么都不起作用。

任何帮助都是非常感谢的。谢谢!

EN

回答 2

Stack Overflow用户

发布于 2014-09-11 03:32:47

尝试删除此目录:

代码语言:javascript
复制
/Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18  

如果这不能帮助删除rvm目录并重新安装

票数 1
EN

Stack Overflow用户

发布于 2015-09-13 12:35:12

首先,确保gem可以在安装时编译。

代码语言:javascript
复制
gem install mysql

代码语言:javascript
复制
brew install mysql
gem install mysql2

最后,Gemfile中mysql2 gem的版本可能已经过期,需要更新。

代码语言:javascript
复制
bundle update mysql2
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25771987

复制
相关文章

相似问题

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