Rails - 无法在Windows 8.1上为Paperclip安装rmagick

时间:2014-07-18 02:18:34

标签: ruby-on-rails ruby gem paperclip

我的Rails 4.1应用程序中需要paperclip。但我无法在Windows 8.1中安装rmagick gem

我的机器已经安装了 DevKit ImageMagick 6.8.9 。然后我尝试使用以下命令安装rmagick gem:

gem install rmagick --platform=ruby -- --with-opt-dir=C:/ImageMagick-6.8.9-Q16

它说“无法构建本机gem扩展”并要求我查看mkmf.log以获取详细信息。这是日志:

"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -IC:/ImageMagick-6.8.9-Q16/include -DFD_SETSIZE=2048  -DFD_SETSIZE=2048  -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby193/lib -LC:/ImageMagick-6.8.9-Q16/lib -L.    -lCORE_RL_magick_ -lX11  -lmsvcrt-ruby191  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lCORE_RL_magick_
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lX11
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

尝试使用Google搜索该错误但找不到任何内容。

注意

这是我收到的完整的第一条错误消息:

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:/Ruby193/bin/ruby
C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postp
one'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
        from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
        from extconf.rb:194:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/rmagick-2
.13.2 for inspection.

1 个答案:

答案 0 :(得分:2)

您不需要rmagick gem来运行Paperclip。您只需要在系统上安装ImageMagick。从您的Gemfile中删除rmagick。