gpt4 book ai didi

ruby-on-rails - gem 安装 rmagick 错误

转载 作者:数据小太阳 更新时间:2023-10-29 08:08:11 24 4
gpt4 key购买 nike

我知道有很多关于这个错误的问题,但我阅读了几个教程和 SO 讨论,但没有找到解决方案。

我正在尝试安装 rmagick(我想为 Ruby on Rails 安装 Spree 电子商务,这需要 ImageMagick 和 rmagick)。

我在 Windows 7(64 位)上工作,Ruby 版本是:2.1.5,Rails 版本是 4.2.1。我下载并安装了(在 C:\ImageMagick 中)ImageMagick-6.9.1-2-Q16-x64-dll.exe,我还安装了 Dev-Kit。

我按照 Sumit Munot 在 ImageMagick Install Windows 此处建议的步骤操作,但是当我按照第 6 步操作时,出现此错误。

C:\Sites>gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

C:/RailsInstaller/Ruby2.1.0/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/Ruby2.1.0/bin/ruby
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler
failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'

from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1067:in `block i
n have_header'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in
checking_for'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2
levels) in postpone'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in
postpone'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone
'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking
_for'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1066:in `have_he
ader'
from extconf.rb:37:in `configure_headers'
from extconf.rb:17:in `initialize'
from extconf.rb:474:in `new'
from extconf.rb:474:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/rmagick-2.15.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/rmagick-2.15.0/gem_make.out

C:\Sites>gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

C:/RailsInstaller/Ruby2.1.0/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/Ruby2.1.0/bin/ruby
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler
failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'

from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1067:in `block i
n have_header'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:918:in `block in
checking_for'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block (2
levels) in postpone'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:351:in `block in
postpone'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:347:in `postpone
'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:917:in `checking
_for'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/mkmf.rb:1066:in `have_he
ader'
from extconf.rb:37:in `configure_headers'
from extconf.rb:17:in `initialize'
from extconf.rb:474:in `new'
from extconf.rb:474:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1
.0/gems/rmagick-2.15.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86
-mingw32/2.1.0/rmagick-2.15.0/gem_make.out

这是我的路径:C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.1.0\bin;C:\Ruby21\bin;我必须在路径中添加一些东西吗?

最佳答案

是的,遇到了同样的麻烦,又给了它第二次机会。

  • 删除当前的 ImageMagic 文件夹和 rmagick gem
  • here 安装 ImageMagick-6.7.9-3-Q16-windows-dll.exe和 ImageMagick-6.7.9-2-Q8-windows-static.exe 在同一文件夹中(这些有效,而最近的无效)
  • 在您的控制台窗口中 set path=d:\ImageMagick;%path%
  • gem install rmagick -- '--with-opt-dir="d:\ImageMagick"'

我显然在 d:\ImageMagick 中安装了 ImageMagick,因此请根据您的情况进行调整。这适用于我在 Windows 7 下的 Ruby 1.9.3,成功!

关于ruby-on-rails - gem 安装 rmagick 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30119781/

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