0

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

安装 mysql2 gem 时出现以下错误,谁能指出我正确的方向来安装 mysql2 gem,这样我就可以使用 ruby​​ on rails 和 mysql,然后最终使用 web serer。

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

错误:安装 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>'
4

1 回答 1

0

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

于 2013-06-11T16:41:48.103 回答