开发者

on windows Mysql native extension prob in ruby on rails gem time

开发者 https://www.devze.com 2023-04-02 08:32 出处:网络
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

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. This below error happens when bundle install is on stage of:

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. (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 was released without binaries for 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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消