加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Ruby gem mysql2安装错误

发布时间:2020-12-16 19:56:47 所属栏目:百科 来源:网络整理
导读:我在 Windows7中安装了 Ruby版本的ruby 1.9.2p0(2010-08-18)[i386-mingw32]. 和宝石血统1.3.7 当我试图安装mysql gem时,显示无法构建gem本机扩展错误,为什么会这样?我的mysql版本是5.1.36(WampServer) E:RubyAppstest_app2gem install mysql2Building nat
我在 Windows7中安装了 Ruby版本的ruby 1.9.2p0(2010-08-18)[i386-mingw32].
和宝石血统1.3.7

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

E:RubyAppstest_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:RubyAppstest_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!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读