【问题标题】:Problems installing RMagick-gem in Rails在 Rails 中安装 RMagick-gem 时出现问题
【发布时间】:2010-10-02 21:07:21
【问题描述】:

我整天都在学习教程,试图安装 RMagick,现在我估计已经走了很远,但偶然发现了一个我真的不知道如何解决的错误,也没有得到任何有用的信息。

当我尝试安装 gem 时,我收到以下消息:

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
 ERROR: Failed to build gem native extension.

C:/Ruby192/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:/Ruby192/bin/ruby
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
 from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
 from extconf.rb:193:in `<main>'


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

我认为粗体部分是重要的部分,我做了一些研究,知道stdint.h是某种头文件,但我不知道如何安装它。

我还检查了 mkmf.log 文件,它为我提供了一些易于阅读的信息:

检查 Ruby 版本 >= 1.8.5... -------------------- 是


"gcc -o conftest -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby192/include/ruby-1.9.1/ruby/backward -IC:/Ruby192/include/ruby-1.9.1 -I.     -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long conftest.c  -L. -LC:/Ruby192/lib -L.    -lCORE_RL_magick_ -lX11  -lmsvcrt-ruby191-static  -lshell32 -lws2_32  "
cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */

有人有什么想法吗?

非常感谢您的帮助!

问候,埃米尔

【问题讨论】:

    标签: ruby-on-rails rmagick stdint


    【解决方案1】:

    我通过运行安装 ImageMagicks devkit 的“apt-get install libmagick9-dev”解决了这个问题。

    【讨论】:

    • windows的等价物是什么?
    • 对不起,从来没有让它在 Windows 上工作......尝试了一整周没有成功。
    【解决方案2】:

    试试这个:

    sudo apt-get install libmagickwand-dev

    它适用于 Ubuntu。

    【讨论】:

      【解决方案3】:

      你在窗户上吗?如果你是,很可能,正如你的日志所说,你需要安装http://rubyforge.org/frs/?group_id=167

      【讨论】:

      • 感谢霞的回答。我在 Windows 上,并且已经安装了 devkit。
      • 对不起,我忽略了这一点,您没有安装正确版本的 rmagick... windows 有一个单独的 gem rmagick-win32,请注意它需要一个非常特定版本的 Image Magick源压缩文件rubyforge.org/frs/?group_id=12
      • 我有同样的问题,我可以确认,即使你安装了devkit也会出现这个错误
      • 嘿,Kasumi,我知道已经过去了三年,但我仍然遇到同样的问题!我安装了 rmagick-win32,甚至出现在我安装的 gem(作为 rmagick)中,但我无法将它包含为 gem
      • 对不起,没看到这个,但是你有更多的信息来说明当你包含它时有什么问题吗?
      猜你喜欢
      • 2011-10-06
      • 2013-10-02
      • 2010-11-18
      • 2013-05-22
      • 1970-01-01
      • 2011-06-02
      • 2023-03-17
      • 1970-01-01
      • 2019-09-03
      相关资源
      最近更新 更多