在windows下,Mysql的本地扩展在Ruby on rails的gem time中出现问题。[英] on windows Mysql native extension prob in ruby on rails gem time

本文是小编为大家收集整理的关于在windows下,Mysql的本地扩展在Ruby on rails的gem time中出现问题。的处理方法,想解了在windows下,Mysql的本地扩展在Ruby on rails的gem time中出现问题。的问题怎么解决?在windows下,Mysql的本地扩展在Ruby on rails的gem time中出现问题。问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

由于我是 ruby​​ on rails 的新手,需要专业人士的帮助,在第一次安装应用程序时,因为我在我的系统上使用 Mysql DB,我也安装了它的 gem,但是当我执行 Bundle install 时出现此错误对于一个新的项目应用程序.以下错误发生在捆绑安装处于以下阶段时:

Installing mysql2 (0.2.13) with native extensions  

C:\Sites\proj2>捆绑安装获取 http://rubygems.org/ 的源索引使用 rake (0.9.2)使用抽象 (1.0.0)使用主动支持 (3.0.9)使用构建器 (2.1.2)使用 i18n (0.5.0)使用 activemodel (3.0.9)使用 erubis (2.6.6)使用机架 (1.2.3)使用机架安装 (0.6.14)使用机架测试(0.5.7)使用 tzinfo (0.3.29)使用动作包 (3.0.9)使用 mime 类型 (1.16)使用多语言 (0.3.2)使用树顶 (1.4.10)使用邮件 (2.2.19)使用 actionmailer (3.0.9)使用 arel (2.0.10)使用活动记录 (3.0.9)使用活动资源 (3.0.9)使用捆绑器 (1.0.15)使用原生扩展安装 mysql2 (0.2.13) C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions': 错误: Fai导致构建 gem 原生扩展.(Gem::Installer::ExtensionBuildError)

        C:/RailsInstaller/Ruby1.8.7/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... no
checking for main() in -llibmysql... no
*** 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:/RailsInstaller/Ruby1.8.7/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-libmysqllib
        --without-libmysqllib


Gem files will remain installed in C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8
/gems/mysql2-0.2.13 for inspection.
Results logged to C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/mysql2-0.2.
13/ext/mysql2/gem_make.out
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/install
er.rb:486:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/install
er.rb:486:in `build_extensions'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/install
er.rb:159:in `install'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/source.rb:101:in `install'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/rubygems_integration.rb:78:in `preserve_paths'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/source.rb:91:in `install'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/installer.rb:58:in `run'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/rubygems_integration.rb:93:in `with_build_args'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/installer.rb:57:in `run'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/spec_set.rb:12:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/spec_set.rb:12:in `each'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/installer.rb:49:in `run'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/installer.rb:8:in `install'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/cli.rb:222:in `install'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/vendor/thor/task.rb:22:in `send'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/vendor/thor/task.rb:22:in `run'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/vendor/thor.rb:246:in `dispatch'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/l
ib/bundler/vendor/thor/base.rb:389:in `start'
        from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.15/b
in/bundle:13
        from C:/RailsInstaller/Ruby1.8.7/bin/bundle:19:in `load'
        from C:/RailsInstaller/Ruby1.8.7/bin/bundle:19

C:\Sites\proj2>

推荐答案

mysql2 0.2.13 已发布,没有适用于 Windows 的二进制文件.因此,需要编译.

由于您使用的是 RailsInstaller,您已经拥有几乎所有的组件来解决这个问题,但我建议您阅读我发布的关于在 Windows 上编译 mysql/mysql2 gem 的博客文章:

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

然后,您可以 bundle install 并且由于 gem 已经安装,之后它应该可以工作了.

本文地址:https://www.itbaoku.cn/post/786379.html