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: 驱动器的各个子文件夹中,名称中没有空格。然后我尝试构建一个宝石。

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

ck-6.8.6-Q16/lib --with-opt-include=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-x64\lib\ruby\gems\2.0.0\gems\rmagick-2.13.2\ext\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 位版本。

4

2 回答 2

1

我遇到了同样的问题。将 Ruby 2.0.0p247 和 gem 2.0.7 与 ImageMagick 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 位版本的 ruby​​ 和 32 位 ImageMagick 库来构建 gem - 它“Just Works”

于 2013-08-23T03:37:38.610 回答
0

您很可能在版本之间存在不匹配:

Ruby x64 将只能编译和安装 rmagick x64

Ruby x86(32 位)将只能编译和安装 rmagick x86

确保安装两者的相同版本。

于 2015-04-06T16:11:20.590 回答