我正在尝试安装mysql2:
sudo gem install mysql2 -v '0.2.7' -- --with-mysql-config=/usr/local/Cellar/mysql/5.5.25a/bin/mysql_config
我收到此错误:
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb -- with-mysql-config=/usr/local/Cellar/mysql/5.5.25a/bin/mysql_config
checking for rb_thread_blocking_region()... 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.
我的 mysql 安装是通过 brew 安装的,所以我的 mysql.h 文件位于:
/usr/local/Cellar/mysql/5.5.25a/bin/mysql_config
这就是为什么我有 with-mysql-config 标志
mysql_config 文件正在这里寻找 mysql.h 文件:
$basedir/include/mysql/mysql.h
应该补充一点,我更新了我的 gemfile
宝石'mysql2
宝石'mysql2','0.2.7'
因为,我收到了一些关于 mysql2 0.3.* 没有活动记录支持的弃用警告。所以要么必须将rails升级到3.1,要么降级mysql2。我选择了后者。
我应该编辑 mysql_config 还是我可以做些什么来解决这个问题?谢谢你的帮助。