1

Ruby Gem のインストールの問題..

次のメッセージを受け取ります

c:\>gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
checking for Ruby version >= 1.8.5... yes
Version: ImageMagick 6.8.7-5 Q16 x86 2013-11-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps tiff webp x xml zlib

checking for stdint.h... "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. -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 -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
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*** 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 generate 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 postpone'
    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>'
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        C:/Ruby193/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:/Ruby193/bin/ruby
C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate 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 postpone'
    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>'


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

どんな助けでも大歓迎です

4

1 に答える 1

1

これは古い投稿であることは知っていますが、最近この問題が発生しました。これは、解決策を見つける前に助けを求めていたときに出会った投稿の 1 つです。この解決策が他に見つからなかったので、他の人に役立つことを期待して、戻ってきて回答を投稿したかったのです。

解決策は 2 つあります。gem install rmagickまず、 ImageMagickをインストールするときに、インストール中にプロンプ​​トが表示されたら、ライブラリとヘッダー ファイルをインストールするボックスにチェックを入れる必要がありますC:\ImageMagick

gem install rmagick --platform=ruby -- --with-opt-lib=C:/ImageMagick/lib --with-opt-include=C:/ImageMagick/include

これにより、ヘッダーとライブラリがどこにあるかがわかり、ld.exe: cannot find -lCORE_RL_magick_エラーが解消されます。

より新しいバージョンの ImageMagick をインストールした場合でも、2 番目のエラーが発生する可能性があります。ImageMagick の最近のインストールでは、開発者が重要なライブラリを含めることに失敗したようです。ディレクトリを見るとImageMagick\lib、そこに 4 つのファイルがあるはずです。3つのCORE_RL*.libファイルとx11.libファイル。x11.libファイルが最近のバージョン (私の場合はバージョン 6.9.0-6) から欠落しています。

解決策は簡単です。ImageMagick をアンインストールし、ここから古いバージョンをダウンロードします。

私の場合、使用しImageMagick-6.7.7-0-Q16-windows-dll.exeました。それをインストールしてlibフォルダーに移動し、x11.libファイルを安全な場所にコピーしてから、ImageMagick を再度アンインストールし、不足しているファイルがある必要な新しいバージョンを再インストールして、ファイルを安全な場所から ImageMagicklibディレクトリにコピーします。

次に、上記の gem install コマンドを実行すると、正常に動作するはずです。

于 2015-02-17T17:08:10.847 に答える