我正在尝试在新的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“清理”了所有东西,尝试重新安装,但似乎什么都不起作用。
任何帮助都是非常感谢的。谢谢!
发布于 2014-09-11 03:32:47
尝试删除此目录:
/Users/royzinn/dailyd/vendor/ruby/1.8/gems/mysql2-0.2.18 如果这不能帮助删除rvm目录并重新安装
发布于 2015-09-13 12:35:12
首先,确保gem可以在安装时编译。
gem install mysqlbrew install mysql
gem install mysql2最后,Gemfile中mysql2 gem的版本可能已经过期,需要更新。
bundle update mysql2https://stackoverflow.com/questions/25771987
复制相似问题