错误信息
ERROR: Error installing mysql-2.9.0.gem: ERROR: Failed to build gem native extension.
解决方案主要参考《2. 安装失败问题处理 》:
step1.
下载 mysql-connector-c-noinstall-6.0.2-win32,并解压至目录
step2.
执行geminstall时添加--with-mysql-lib、 --with-mysql-include参数。
gem install mysql -v 2.9.0 --platform=ruby -- --with-mysql-lib=c:\mysql-connector-c-noinstall-6.0.2-win32\lib --with-mysql-include=C:\mysql-connector-c-noinstall-6.0.2-win32\include
备注:文章中提供的命令并不能正常使用(可能也和win7的环境有关)
gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
参考资源:
1 安装msql说明
http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
2. 安装失败问题处理
http://stackoverflow.com/questions/13604362/installing-mysql-2-9-0-gem-on-windows-fails-due-to-lack-of-libmysql