Windows安装rmagick错误

psa*_*ski 1 ruby windows ruby-on-rails rmagick redmine

规格: - Windows 7 x64 - Ruby 2.0.0 x64 - DevKit-mingw64-64-4.7.2

我尝试安装redmine bundle,但是当我使用时bundle install出现错误

d:\www\xampp\htdocs\projekty\redmine\redmine-2.3.3>bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.1)
Using multi_json (1.8.2)
Using activesupport (3.2.13)
Using builder (3.0.0)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.38)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using bundler (1.3.5)
Using ffi (1.9.1)
Using childprocess (0.3.9)
Using rubyzip (1.0.0)
Using websocket (1.0.7)
Using selenium-webdriver (2.37.0)
Using xpath (1.0.0)
Using capybara (2.0.3)
Using coderay (1.0.9)
Using rack-ssl (1.3.3)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.13)
Using jquery-rails (2.0.3)
Using metaclass (0.0.1)
Using mocha (0.13.3)
Using mysql2 (0.3.13)
Using net-ldap (0.3.1)
Using ruby-openid (2.2.3)
Using rack-openid (1.4.0)
Using rails (3.2.13)
Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    C:/Ruby200-x64/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:/Ruby200-x64/bin/ruby
C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (Ru
ntimeError)
You have to install development tools first.
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:561:in `try_cpp'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1040:in `block in have_header'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:306:in `open'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:306:in `open'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
        from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1039:in `have_header'
        from extconf.rb:194:in `<main>'


Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)

我有ImageMagick

d:\www\xampp\htdocs\projekty\redmine\redmine-2.3.3>convert --version
Version: ImageMagick 6.8.7-2 2013-10-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jbig jng jp2 jpeg lcms lqr png ps png tiff webp xml zlib
Run Code Online (Sandbox Code Playgroud)

我尝试使用这样的东西:

gem install rmagick --platform=ruby -- --with-opt-lib=C:/Ruby200-x64/ImageMagick/lib --with-opt-include=C:/Ruby200-x64/ImageMagick/include
Run Code Online (Sandbox Code Playgroud)

但我得到了同样的错误.我的mkmf.log看起来像这样:

checking for Ruby version >= 1.8.5... -------------------- yes

--------------------

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.    -lCORE_RL_magick_ -lX11  -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Ruby200-x64/ImageMagick/lib/../lib/X11.lib when searching for -lX11
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Ruby200-x64/ImageMagick/lib/X11.lib when searching for -lX11
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Ruby200-x64/ImageMagick/lib/../lib/X11.lib when searching for -lX11
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Ruby200-x64/ImageMagick/lib/../lib\X11.lib when searching for -lX11
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Ruby200-x64/ImageMagick/lib/X11.lib when searching for -lX11
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Ruby200-x64/ImageMagick/lib\X11.lib when searching for -lX11
c:/ruby200-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lX11
collect2.exe: error: 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 */
Run Code Online (Sandbox Code Playgroud)

我不知道自己做错了什么.

Dan*_*elK 6

因此我犯了与你相同的错误,我没有阅读整个redmine安装指南.之后

bundle install --without development test

是关于使用rmagickgem进行故障排除的部分.

http://www.redmine.org/projects/redmine/wiki/HowTo_install_rmagick_gem_on_Windows

简而言之

  • 下载最新的可执行文件,最有可能使用dll.exepostfix(我的是ImageMagick-6.8.7-8-Q16-x86-dll.exe)
  • 勾选复选框以安装标题
  • 将imagemagick目录设置在PATH变量的第一个位置.
  • 设置新的环境变量CPATHC:\ImagemagickInstallation\include
  • 设置新的环境变量 LIBRARY_PATH C:\ImagemagickInstallation\lib
  • 一定要使用32位安装ruby,devkit和imagemagick来做到这一点!

然后只需键入gem install rmagick,本机编译就可以了.只需确保您获得最新的ruby安装(我的是1.9.3)和最新版本的DevKit(我的是DevKit-tdm-32-4.5.2).

如果这对您有用,请告诉我,它终于让我的redmine安装了!