【问题标题】:how do you get rmagick to work on windows 7 64-bit with rails 3.1 and carrierwave?你如何让 rmagick 在带有 rails 3.1 和carrierwave 的 Windows 7 64 位上工作?
【发布时间】:2011-06-03 21:42:33
【问题描述】:

我无法让 rmagick 在 Windows 上工作。有谁知道如何让它正常工作?甚至更好,希望以一种与生产环境兼容的方式,尽管我会尽我所能。

C:\> gem install rmagick --platform=ruby -- --with-opt-lib=%IMAGE_MAGICK_HOME%/lib --with-opt-include=%IMAGE_MAGICK_HOME%/include
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:/ruby192/bin/ruby.exe extconf.rb --with-opt-lib=C:\Program Files (x86)\ImageMagick-6.7.0-Q16/lib --with-opt-include=C:\Program Fil
es (x86)\ImageMagick-6.7.0-Q16/include
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=${opt-dir}/include
        --with-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

【问题讨论】:

  • @Zabba:使用 devkit,它无法正确安装。它需要它找不到的库。我尝试下载 imagemagick 和 rmagick 并编译它们,但是当我尝试编译 rmagick 时它失败了。 devkit 只是没有做我认为应该做的事情。基本上,gem install rmagick 不会“正常工作”——远非如此:/

标签: ruby-on-rails ruby windows rmagick


【解决方案1】:

在这个帖子中的答案使它在我的两台电脑上都可以工作:RMagick on Windows

我希望它也对你有用!

【讨论】:

  • 我做了大部分。我将粘贴错误。伙计,我希望这更容易。 Rmagick 是大多数人想要的东西。我希望 devkit 默认提供一些帮助。这对每个人来说都太难了:(
  • 终于让它工作了。我不知道我实际上做了什么。它刚刚开始工作。
【解决方案2】:

供将来参考:我刚刚使用 reddit 帖子中的说明将 rmagick 安装到 Windows 上的 Ruby 2.1-x64 中,转贴如下:


http://rubyinstaller.org/downloads/ 下载 Ruby 开发工具包并在某处解压。 (顺便说一句,你的 Ruby 也必须来自 Rubyinstaller,否则开发工具包说它不起作用。)

通过做来初始化你的 DevKit

dk.rb init

这将创建一个 config.yml,其中包含在您的系统上找到的红宝石列表,您可以对其进行编辑并删除您不关心的那些

dk.rb review

确保上一步顺利进行

dk.rb install

要将 DevKit 安装到该 Ruby 中,完成此操作后,您将能够编译原生 Ruby 扩展。

Link 下载 ImageMagick(ImageMagick-6.9.2-3-Q16-x64-dll.exe 对我有用),然后将其安装到没有空格的路径。确保选中Add application directory to system pathInstall headers and libraries for C and C++

重新启动命令行窗口以确保对 PATH 进行了更改。

快速设置 PATH 以确保 ImageMagick 位于 PATH 中的第一位,否则安装将失败(因为安装脚本调用了来自 ImageMagick 的 convert.exe,但也存在 C:\Windows\system32\convert.exe。 exe)。

运行以下行,适当地替换系统上 ImageMagick 的位置(您记得,它不应包含空格):

gem install rmagick --platform=ruby -- --with-opt-lib=D:/Tools/ImageMagick-6.9.2-Q16/lib --with-opt-include=D:/Tools/ImageMagick-6.9.2-Q16/include --with-opt-dir=D:/Tools/ImageMagick-6.9.2-Q16

它应该搅拌几分钟,然后你就变成了金色。

顺便说一句,只要您打算使用 RMagick,您就必须在 PATH 中使用 ImageMagick。

【讨论】:

    猜你喜欢
    • 2013-11-10
    • 1970-01-01
    • 2011-01-02
    • 2011-03-29
    • 1970-01-01
    • 2012-06-14
    • 2012-04-01
    • 2011-09-22
    • 1970-01-01
    相关资源
    最近更新 更多