简体   繁体   English

在Windows上的Mysql本机扩展问题在ruby on rails gem time

[英]on windows Mysql native extension prob in ruby on rails gem time

As I'm new to ruby on rails,need help of pro's,in first app installation,as I'm using Mysql DB on my system,i installed its gem also,but Im getting this error when I doing Bundle install for a new project app. 因为我刚接触ruby on rails,需要专业人士的帮助,在第一个应用程序安装中,因为我在我的系统上使用Mysql DB,我也安装了它的gem,但是当我做一个新的Bundle安装时我得到了这个错误项目应用。 This below error happens when bundle install is on stage of: bundle install处于以下阶段时, 会发生以下错误

Installing mysql2 (0.2.13) with native extensions  

C:\\Sites\\proj2>bundle install Fetching source index for http://rubygems.org/ Using rake (0.9.2) Using abstract (1.0.0) Using activesupport (3.0.9) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.9) Using erubis (2.6.6) Using rack (1.2.3) Using rack-mount (0.6.14) Using rack-test (0.5.7) Using tzinfo (0.3.29) Using actionpack (3.0.9) Using mime-types (1.16) Using polyglot (0.3.2) Using treetop (1.4.10) Using mail (2.2.19) Using actionmailer (3.0.9) Using arel (2.0.10) Using activerecord (3.0.9) Using activeresource (3.0.9) Using bundler (1.0.15) Installing mysql2 (0.2.13) with native extensions C:/RailsInstaller/Ruby1.8.7/li b/ruby/site_ruby/1.8/rubygems/installer.rb:533:in `build_extensions': ERROR: Fai led to build gem native extension. C:\\ Sites \\ proj2> bundle install获取http://rubygems.org/的源索引使用rake(0.9.2)使用abstract(1.0.0)使用activesupport(3.0.9)使用builder(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)使用actionpack(3.0.9)使用mime-types(1.16)使用polyglot(0.3.2)使用treetop(1.4.10)使用mail(2.2.19)使用actionmailer(3.0.9)使用arel(2.0.10) )使用activerecord(3.0.9)使用activeresource(3.0.9)使用bundler(1.0.15 )使用本机扩展安装mysql2(0.2.13) C:/RailsInstaller/Ruby1.8.7/li b / ruby​​ / site_ruby / 1.8 / rubygems / installer.rb:533:在`build_extensions'中:错误:Fai导致构建gem原生扩展。 (Gem::Installer::ExtensionBuildError) (宝石::安装:: 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 was released without binaries for Windows. mysql2 0.2.13发布时没有Windows的二进制文件。 Because of that, compilation is required. 因此,需要编译。

Since you're using RailsInstaller, you already have pretty much all the components to solve this, but I will recommend you read a blog article I posted about compiling mysql/mysql2 gem on Windows: 由于您使用的是RailsInstaller,因此您已经拥有了解决此问题的所有组件,但我建议您阅读我发布的关于在Windows上编译mysql / mysql2 gem的博客文章:

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

Then, you can bundle install and since the gem was already installed, it should be working afterwards. 然后,你可以bundle install ,因为已经安装了gem,它应该在之后工作。

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

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