简体   繁体   English

安装mysql或mysql2 gem时出现问题

[英]Issues installing mysql or mysql2 gem

I have ruby version 2.0.0.0p195 (2013-05-14) [x64-mingw32] installed as well as ruby gem version 2.0.3 installed. 我安装了ruby版本2.0.0.0p195(2013-05-14)[x64-mingw32]以及安装的ruby gem版本2.0.3。 I just recently installed MySQL Community Server 5.6.12 (32 bit) installer as well. 我最近还安装了MySQL Community Server 5.6.12(32位)安装程序。 I am trying to get the mysql or mysql2 gem to work and then get a server installed to learn more about Ruby on Rails. 我正在尝试使mysql或mysql2 gem工作,然后安装服务器以了解有关Ruby on Rails的更多信息。

When installing the mysql2 gem I get this error below, can anyone point me in the right direction to get mysql2 gem installed so i can use ruby on rails with mysql and then a web serer eventually. 当安装mysql2 gem时,出现以下错误,任何人都可以指出正确的方向来安装mysql2 gem,这样我就可以在使用mysql的Rails上使用ruby,然后最终进行网络服务。

Building native extensions. 构建本机扩展。 This could take awhile... 这可能需要一段时间...

ERROR: Erorr intalling mysql2: ERROR: Failed to build gem native extension 错误:错误安装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>'

I found the answer (for me) to be using rails installer and uninstalling my old ruby information. 我发现答案(对我来说)是使用Rails安装程序并卸载旧的ruby信息。 Rails installer includes ruby, rails and sqllite3. Rails安装程序包括ruby,rails和sqllite3。 As well, then I installed WEBrick which runs off of localhost:3000. 同样,然后我安装了从本地主机:3000运行的WEBrick。 It allows me to have WAMP and Ruby/WEBrick. 它使我可以使用WAMP和Ruby / WEBrick。 This isn't ideal since everything isn't running on one area, but is great for what I need it for which is learning and a side project I want to develop using HTML5 and/or Rails (a media application). 这不是理想的,因为并非所有内容都在一个区域上运行,但是它非常适合我需要的学习和我想使用HTML5和/或Rails(媒体应用程序)开发的辅助项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM