[英]fail to install mysql2 gem
我正在尝试在新的Mavericks机器上设置一个不太旧(但还几年)的Rails项目。 当我尝试bundle
,我不断收到此错误(对较长的代码表示抱歉):
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“清理”了所有东西,尝试重新安装,但似乎无济于事。
非常感谢您的帮助。 谢谢!
尝试删除此目录:
/Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18
如果这不帮助删除rvm目录并重新安装
首先,确保gem可以在安装时编译。
gem install mysql
如果您发现无法编译gem的错误,则可能有必要在Bundler可以找到它的地方安装MySQL-即使OS X附带了它。与其将路径作为参数传递给Bundler,不如将MySQL与Homebrew一起安装然后安装gem。
brew install mysql
gem install mysql2
最后,mysql2 gem的版本在Gemfile中可能已过时,需要更新。
bundle update mysql2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.