简体   繁体   中英

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. I just recently installed MySQL Community Server 5.6.12 (32 bit) installer as well. 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.

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.

Building native extensions. This could take awhile...

ERROR: Erorr intalling mysql2: ERROR: Failed to build gem native extension

> 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 installer includes ruby, rails and sqllite3. As well, then I installed WEBrick which runs off of localhost:3000. It allows me to have WAMP and 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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