2013-07-17 92 views
2

來自Rails和Bundler的新手。rmagick gem安裝在windows上,但捆綁失敗

我能夠與微軟Windows 7安裝rmagick 2.13.2:

gem install rmagick -v 2.13.2 -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include --local 

哪工作,在此輸出所示:

Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
Successfully installed rmagick-2.13.2 
1 gem installed 
Installing ri documentation for rmagick-2.13.2... 
Installing RDoc documentation for rmagick-2.13.2... 

但我不能讓打捆使用我的Gemfile,包含行:

gem "rmagick" 

但命令:

bundle install --path vendor/bundle/ 

斷層上rmagick這樣的:

Installing rmagick (2.13.2) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension 
. 

    C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb 
checking for Ruby version >= 1.8.5... yes 
checking for stdint.h... *** 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.9.3/bin/ruby 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler 
failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp' 

    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:931:in `block in 
have_header' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:790:in `block in 
checking_for' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 
levels) in postpone' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block in 
postpone' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `postpone 
' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:789:in `checking 
_for' 
    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:930:in `have_hea 
der' 
    from extconf.rb:194:in `<main>' 


Gem files will remain installed in c:/ew/j2ee/axxon.dash/vendor/bundle/ruby/1.9. 
1/gems/rmagick-2.13.2 for inspection. 
Results logged to c:/ew/j2ee/axxon.dash/vendor/bundle/ruby/1.9.1/gems/rmagick-2. 
13.2/ext/RMagick/gem_make.out 
An error occurred while installing rmagick (2.13.2), and Bundler cannot 
continue. 
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling. 

此外,

>gem list rmagick 

*** LOCAL GEMS *** 

rmagick (2.13.2) 

我檢查和rmagic似乎被安裝在供應商\包\紅寶石\ 1.9.1 \寶石\ rmagick -2.13.2

所以如果安裝了,爲什麼bundle安裝會抱怨? 我可以欺騙打包商並強制它識別我所做的事或什麼?

TIA。

回答

4

你應該定義rmagick寶石是這樣的:

gem 'rmagick', '~> 2.13.2', :platforms => :ruby 
gem 'rmagick', '=2.13.2.mswin32', :platforms => :mswin 

希望這會有所幫助。