rmagick gem安装在Windows上但捆绑失败

时间:2013-07-17 14:50:13

标签: ruby-on-rails windows rmagick

来自Rails和Bundler的新手。

我能够在MS 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...

但我无法让bundler使用我的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似乎安装在vendor \ bundle \ ruby​​ \ 1.9.1 \ gems \ rmagick-2.13.2

所以,如果安装了,为什么捆绑安装会抱怨? 我可以欺骗捆绑商并强迫它识别我做过什么或什么吗?

TIA。

1 个答案:

答案 0 :(得分:4)

你应该像这样定义rmagick gem:

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

希望这会有所帮助。

相关问题