在Ruby中安装MYSQL Gems时出错

时间:2013-09-04 07:29:46

标签: mysql ruby-on-rails ruby-on-rails-3 gem

在过去3个月我面对这个问题时,我需要一个很大的帮助。

我正在使用windows 8机器。

我试图在ruby中安装rails。一切都取得了成功。

但在安装mysql gem时,我可能会遇到许多错误,我已经复制并粘贴在

下面
C:\Users\Mounarajan P A>gem install mysql
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... no
*** 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=C:/Ruby200-x64/bin/ruby
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/
    --with-libmysqllib
    --without-libmysqllib


 Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql
-2.9.1 for inspection.
 Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_
api/gem_make.out

2 个答案:

答案 0 :(得分:1)

实际上,在安装本机扩展时,我们应该拥有本机开发库。对于ubuntu,它是libmysql2-dev,以同样的方式查找windows的dev lib并安装它。这可以解决你的问题

答案 1 :(得分:1)

您的意思是使用mysql宝石吗?我认为mysql2现在是与mysql数据库一起使用的标准/推荐gem。

无论如何,此链接可能会帮助您安装它: Unable to install mysql2 gem on windows 7