2013-07-11 171 views
4

我試圖在Windows 8,Ruby 2.0上安裝Rmagick gem - 所有這些都帶有64位風格。 我使用RubyInstaller安裝了Ruby 2.0 - 版本2.0.0p247,在上面安裝了DevKit-mingw64-64-4.7.2-20130224。然後我安裝了ImageMagic - ImageMagick-6.8.6-4-Q16-x64-dll版本,當然還有開發者頭文件。所有這些都直接在C:驅動器的相應子文件夾中,名稱中沒有空格。 然後我試着建立一個寶石。在Windows 8 x64上安裝rmagick gem for Ruby 2.0 x64

gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagi 

CK-6.8.6-Q16/lib中--with-OPT-包括= C:/ImageMagick-6.8.6-Q16/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:/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 ge 
nerate an executable file. (RuntimeError) 
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 p 
ostpone' 
     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/rmagi 
ck-2.13.2 for inspection. 
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2/ext/RMa 
gick/gem_make.out 

但是我認爲這個問題不在stdint.h文件中。然後我檢查文件的內容

C:\ Ruby200-64 \ LIB \紅寶石\寶石\ 2.0.0 \寶石\ rmagick-2.13.2 \分機\ RMagick \

哪個

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. -Ic:/ImageMagick-6.8.6-Q16/include -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 -Lc:/ImageMagick-6.8.6-Q16/lib -L. -lCORE_RL_magick_ -lX11 -lx64-msvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi " 
c:/devkit-x64/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/ImageMagick-6.8.6-Q16/lib/X11.lib when searching for -lX11 
c:/devkit-x64/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/ImageMagick-6.8.6-Q16/lib/X11.lib when searching for -lX11 
c:/devkit-x64/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/ImageMagick-6.8.6-Q16/lib\X11.lib when searching for -lX11 
c:/devkit-x64/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 */ 

看起來像X11.lib文件的問題。當然,它位於ImageMagick lib文件夾中,它的日期爲2009年,我不知道下一步該做什麼或想什麼。 由於我正在處理大文件 - 6000x6000像素,我希望在可能的情況下使用64位版本。

回答

1

我遇到了同樣的問題。在ImageMagick中使用Ruby 2.0.0p247和gem 2.0.7 6.8.6

我試過了32位和64位版本的ImageMagick。在這兩種情況下,終端輸出是一樣的:

$ gem install rmagick --platform=ruby -- --with-opt-dir=/c/ImageMagick64 
Temporarily enhancing PATH to include DevKit... 
Building native extensions with: '--with-opt-dir=c:/ImageMagick64' 
This could take a while... 
ERROR: Error installing rmagick: 
     ERROR: Failed to build gem native extension. 

    c:/Ruby200-x64/bin/ruby.exe extconf.rb --with-opt-dir=c:/ImageMagick64 
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 
     --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 ge 
nerate an executable file. (RuntimeError) 
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 p 
ostpone' 
     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/rmagi 
ck-2.13.2 for inspection. 
Results logged to c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2/ext/RMa 
gick/gem_make.out 

然而,當我使用32位版本,該mkmf.log文件給我一個錯誤兩個CORE_RL_magick_.lib和X11.lib(不兼容版本) 。當我使用64位版本時,我只在X11.lib上出現錯誤。

這使我相信X11.lib是壞的,也許是他們的發行版中包含的32位版本。

我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. -Ic:/ImageMagick64/include -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 -Lc:/ImageMagick64/lib -L. -lCORE_RL_magick_ -lX11 -lx64-msvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi " 
c:/ruby200-x64/rubydevkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/ImageMagick64/lib/X11.lib when searching for -lX11 
c:/ruby200-x64/rubydevkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/ImageMagick64/lib/X11.lib when searching for -lX11 
c:/ruby200-x64/rubydevkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible c:/ImageMagick64/lib\X11.lib when searching for -lX11 
c:/ruby200-x64/rubydevkit/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 */ 

我知道這並不一定回答這個問題,但我能得到通過使用32位版本的內置寶石紅寶石與32位ImageMagick庫 - 它「只是工作」

0

很可能是因爲版本之間的不匹配:

紅寶石64 WIL l只有能夠編譯並安裝rmagick 64

紅寶石的x86(32位)只能編譯和安裝rmagick 86

確保您同時安裝的版本相同。