"rmagick"宝石安装问题

Ran*_*ana 67 ruby gem

我在尝试在centos上安装"rmagick"gem时遇到了问题.以下是我的输出.任何人都可以帮我确定我错过的包裹吗?我已经安装了所有提到的另一个堆栈溢出线程:RMagick安装错误

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.2. Can't find MagickWand.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=/usr/local/bin/ruby


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
Run Code Online (Sandbox Code Playgroud)

按照以下建议,现在我得到这个输出:

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... 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=/usr/local/bin/ruby
/usr/local/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 /usr/local/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /usr/local/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
    from extconf.rb:194:in `<main>'


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
Run Code Online (Sandbox Code Playgroud)

输出mkmf.log:

checking for HDRI disabled version of ImageMagick... -------------------- yes

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

"gcc -o conftest -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I.  -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6    -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6   conftest.c  -L. -L/usr/local/lib -Wl,-R/usr/local/lib  -L/usr/lib -lMagickCore-6.Q16      -L/usr/lib -lMagickCore-6.Q16    -Wl,-R -Wl,/usr/local/lib -L/usr/local/lib -lruby-static  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: skipping incompatible /usr/lib/libMagickCore-6.Q16.so when searching for -lMagickCore-6.Q16
/usr/bin/ld: cannot find -lMagickCore-6.Q16
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
Run Code Online (Sandbox Code Playgroud)

gem_make.out的输出与上面的终端输出相同.

Sac*_*ngh 135

尝试安装

  sudo apt-get install libmagickwand-dev imagemagick
Run Code Online (Sandbox Code Playgroud)

  • @Sławosz你在这里:`yum install ImageMagick-devel ImageMagick` (11认同)
  • 看起来很有希望,但仅限于ubuntu (9认同)
  • 在ubuntu 12.04上工作 (3认同)
  • 在Ubuntu 15上工作 (2认同)

mme*_*ell 33

在MacOS塞拉利昂ImageMagick的7 RMagick 2.16找不到MagickWand.h工程Rmagick 2.16.

brew install imagemagick@6
brew link --force imagemagick@6
gem install rmagick
Run Code Online (Sandbox Code Playgroud)

  • 如果您使用自制软件并且在使用 ImageMagick7 时遇到问题,这是正确的答案。 (2认同)
  • `brew link --force imagemagick@6` 帮助我安装 gem dhash。 (2认同)

tor*_*o2k 17

错误消息说:

Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Run Code Online (Sandbox Code Playgroud)

看起来你根本没有丢包,你只需要告诉pkg-config在哪里找到MagickCore.pc构建扩展的文件.如果您已经ImageMagick-devel使用yum该文件安装了包,则应该在目录内/usr/lib/pkgconfig/usr/lib64/pkgconfig(取决于您的体系结构).请使用此命令(从现在开始我以为你是AMD64的机器上,如果不是的情况下替换lib64lib):

$ find /usr/lib64/pkgconfig -name MagickCore.pc
Run Code Online (Sandbox Code Playgroud)

如果文件在那里,您只需rmagick使用此命令安装:

$ PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick
Run Code Online (Sandbox Code Playgroud)


Fad*_*ils 7

对于带Brew的Mac,只需..

brew install imagemagick

然后gem install imagemagick会顺利进行.


Ser*_*dan 6

问题是,正如错误所说,

在pkg-config搜索路径中找不到包MagickCore

在那里也提出了解决方案:

将包含的目录添加MagickCore.pcPKG_CONFIG_PATH环境变量中

所以,

  1. 找到MagickCore.pc的位置:

    sudo find / -name MagickCore.pc
    
    Run Code Online (Sandbox Code Playgroud)
  2. 如果找不到,可能是你的系统上没有安装ImageMagick - 然后安装它(Google如何操作,因为它取决于操作系统)

  3. 将它保存到ENV var(确保放置步骤1中找到的路径):

    PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
    
    Run Code Online (Sandbox Code Playgroud)
  4. 重试安装RMagick

  • `目录包含'意味着您必须删除文件名才能使其工作.所以`PKG_CONFIG_PATH =/usr/lib/x86_64-linux-gnu/pkgconfig`. (2认同)