Ruby gem mysql2安装错误

前端之家收集整理的这篇文章主要介绍了Ruby gem mysql2安装错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 Windows7中安装了 Ruby版本的ruby 1.9.2p0(2010-08-18)[i386-mingw32].
和宝石血统1.3.7

当我试图安装MysqL gem时,显示无法构建gem本机扩展错误,为什么会这样?我的MysqL版本是5.1.36(WampServer)

E:\RubyApps\test_app2>gem install MysqL2
Building native extensions.  This could take a while...
ERROR:  Error installing MysqL2:
        ERROR: Failed to build gem native extension.

E:/Ruby192/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=E:/Ruby192/bin/ruby
E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier Failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_func'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postp
one'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
        from E:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func'
        from extconf.rb:9:in `<main>'


Gem files will remain installed in E:/Ruby192/lib/ruby/gems/1.9.1/gems/MysqL2-0.
2.3 for inspection.
Results logged to E:/Ruby192/lib/ruby/gems/1.9.1/gems/MysqL2-0.2.3/ext/MysqL2/ge
m_make.out

E:\RubyApps\test_app2>

解决方法

由于这不断在谷歌上出现在顶级的结果,我应该指出,这个答案是从近两年前.这是一个更新的答案: How to use “mysql2” gem in Rails 3 application on Windows 7?

根据开发人员的说法,已经有一个报告的错误,他正在努力将MysqL2分配到Windows.到目前为止 – 它仍然在作品中.现在使用较旧的MysqL驱动程序 – 或者使用sqlite进行本地开发.

这是从googlegroups讨论

Blockquote Hey Erwann,There’s a ticket on the MysqL2 issue tracker for Win32 support already at 07001 . You can follow it for progress; I’m doing my best to get things working smoothly for you guys. Hang tight! 原文链接:https://www.f2er.com/ruby/272290.html

猜你在找的Ruby相关文章