安装mysql或mysql2 gem的问题

时间:2013-06-09 19:52:23

标签: ruby-on-rails gem mysql2

我安装了ruby版本2.0.0.0p195(2013-05-14)[x64-mingw32]以及ruby gem版本2.0.3。我刚刚安装了MySQL社区服务器5.6.12(32位)安装程序。我试图让mysql或mysql2 gem工作,然后安装服务器以了解有关Ruby on Rails的更多信息。

当安装mysql2 gem我在下面得到这个错误时,任何人都可以指出我正确的方向来安装mysql2 gem所以我可以使用mysql在rails上使用ruby然后最终使用web serer。

构建原生扩展。这可能需要一段时间......

错误:Erorr intalling mysql2:    错误:无法构建gem原生扩展

> C:/Ruby200-x64/bin/ruby.exe extconf.rb checking for
> rb_thread_blocking_region()... *** 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
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler
> failed to generate an executable file. (RuntimeError) You have to
> install development tools first.  from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'  from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'   from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'   from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1001:in `block in have_func'
>   from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in `block in
> checking_for'     from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in
> `block (2 levels) in postpone'    from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'   from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpone'  from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'   from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'   from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'   from
> C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1000:in `have_func'     from
> extconf.rb:9:in `<main>'

1 个答案:

答案 0 :(得分:0)

我找到答案(对我来说)使用rails安装程序并卸载我的旧ruby信息。 Rails安装程序包括ruby,rails和sqllite3。同样,我安装了运行localhost:3000的WEBrick。它允许我拥有WAMP和Ruby / WEBrick。这并不理想,因为一切都没有在一个区域上运行,但是对于我需要的东西来说是非常好的,这是我想要使用HTML5和/或Rails(媒体应用程序)开发的一个副项目。