gpt4 book ai didi

ruby-on-rails - rmagick gem 安装在 Windows 上但捆绑失败

转载 作者:可可西里 更新时间:2023-11-01 09:59:50 27 4
gpt4 key购买 nike

来自 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

那么,如果已安装,为什么 bundle install 会报错?我可以欺骗 bundler 并强制它识别我所做的事情吗?

TIA。

最佳答案

你应该像这样定义 rmagick gem :

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

希望这会有所帮助。

关于ruby-on-rails - rmagick gem 安装在 Windows 上但捆绑失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17703078/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com