在windows下的rmagick

Joe*_*ann 7 ruby windows rmagick

我只是想在windows下安装rmagick.

所以我用C/C++标头安装了ImageMagick,但似乎没有必要了.

然后我安装了Ruby Build Tools

ruby dk.rb init
ruby dk.rb install
Run Code Online (Sandbox Code Playgroud)

然后我想安装rmagick gem gem install rmagick.

但我得到这个错误:

H:\Downloads\ruby build tools>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:/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
Run Code Online (Sandbox Code Playgroud)

在我安装Build Tools之前,我得到了安装它们的建议.

现在它们已安装,我收到的错误消息与之前不同(见上文).

它仍然要我安装Build Tools,所以它的安装可能会被破坏?

我使用linecache得到了同样的错误......还有mkmf文件和构建工具.

我想这是一个常见的错误.

Dar*_*rme 3

我在Windows Vista的Rails环境中安装了 ImageMagick 和 RMagick,如下所示:

首先,我从http://www.imagemagick.org/download/binaries/下载ImageMagick-6.6.7-Q16并将其安装在“C:\ImageMagick-6.6.7-Q16”文件夹中。

然后我从https://github.com/rmagick/rmagick/zipball/master下载了RMagick并将其解压到“C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\bundler\gems\rmagick- rmagick\”文件夹(这是我的 ruby​​ 捆绑器 gems 文件夹)。

然后我简单地打电话

'gem install rmagick' 
Run Code Online (Sandbox Code Playgroud)

根据我的提示,一切正常。

现在我可以从 Rails 应用程序 Gemfile 进行调用

gem "rmagick"
Run Code Online (Sandbox Code Playgroud)

然后“捆绑安装”就可以正常工作了。

PS:请注意,我首先使用http://www.railsinstaller.org安装了 Rails 。