ruby “rmagick” gem 安装问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16774501/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:00:07  来源:igfitidea点击:

"rmagick" gem installation issue

rubygem

提问by Rana

I am having issue while trying to install "rmagick" gem on centos. Following is the output I am having. Can anyone please help me identifying what package I am missing? I have installed all mentioned another stack-overflow thread: RMagick install error

我在尝试在 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

After following suggestions, now I am getting this output:

经过以下建议,现在我得到了这个输出:

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

Output Of mkmf.log:

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"

Output of gem_make.out is same as the terminal output above.

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

回答by Sachin Singh

try installing

尝试安装

  sudo apt-get install libmagickwand-dev imagemagick

回答by mmell

This ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.hworks for Rmagick 2.16.

ImageMagick的7 RMagick 2.16在MacOS塞拉利昂找不到MagickWand.h作品Rmagick 2.16。

brew install imagemagick@6
brew link --force imagemagick@6
gem install rmagick

回答by toro2k

The error message says:

错误消息说:

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

It seems you missing no package at all, you just have to tell pkg-configwhere to find the MagickCore.pcfile to build the extension. If you have installed the package ImageMagick-develusing yumthe file should be inside the directory /usr/lib/pkgconfigor /usr/lib64/pkgconfig(depending on your architecture). Check with this command (from now I assume you are on a amd64 machine, if it's not the case replace lib64with lib):

似乎您根本没有丢失任何包,您只需要告诉pkg-config在哪里可以找到MagickCore.pc文件来构建扩展。如果您已经安装了ImageMagick-devel使用yum该文件的包,则该文件应该位于目录/usr/lib/pkgconfig/usr/lib64/pkgconfig(取决于您的架构)。检查此命令(从现在开始,我假设您在 amd64 机器上,如果不是这种情况,请替换lib64lib):

$ find /usr/lib64/pkgconfig -name MagickCore.pc

If the file is there you just have to install rmagickwith this command:

如果文件在那里,您只需要rmagick使用以下命令进行安装:

$ PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick

回答by Fadils

For Mac with Brew, simply..

对于带有 Brew 的 Mac,只需..

brew install imagemagick

brew install imagemagick

Then gem install imagemagickwill work smoothly.

然后gem install imagemagick就可以顺利工作了。

回答by Sergey Pedan

The problem is, as the error puts it,

问题是,正如错误所说,

Package MagickCore was not found in the pkg-config search path

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

The solution is also suggested there:

那里还建议了解决方案:

add the directory containing MagickCore.pcto the PKG_CONFIG_PATHenvironment variable

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

So,

所以,

  1. Find MagickCore.pclocation:

    sudo find / -name MagickCore.pc
    
  2. If it is not found, probably ImageMagick is not installed on your system —?then install it (Google how to do it, as it depends on the OS)

  3. Save it to the ENV var like that (make sure to put the path found in step 1):

    PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
    
  4. Retry installing RMagick

  1. 找到MagickCore.pc位置:

    sudo find / -name MagickCore.pc
    
  2. 如果没有找到,可能你的系统上没有安装 ImageMagick——然后安装它(谷歌怎么做,因为它取决于操作系统)

  3. 像这样将其保存到 ENV 变量中(确保放置在步骤 1 中找到的路径):

    PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
    
  4. 重试安装 RMagick

回答by Darshan Rivka Whittle

It doesn't look like you're missing any packages. The error message is important:

看起来您没有丢失任何包裹。错误信息很重要:

Perhaps you should add the directory containing `MagickCore.pc' to the PKG_CONFIG_PATH environment variable

也许您应该将包含“MagickCore.pc”的目录添加到 PKG_CONFIG_PATH 环境变量中

Several of the answers on this superuser duplicategive good advice.

关于这个超级用户副本的几个答案给出了很好的建议。

回答by Spikolynn

On debian (unstable) the correct packages needed to resolve this error were libmagickcore-6.q16-dev, imagemagickand libmagickwand-6-headers

在 debian (unstable) 上,解决此错误所需的正确软件包是libmagickcore-6.q16-dev,imagemagicklibmagickwand-6-headers

I found them by using apt-file search MagickCore.pcand apt-file search MagickWand.h

我通过使用apt-file search MagickCore.pc和找到它们apt-file search MagickWand.h