“ rmagick” gem安装问题


68

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

在遵循建议之后,现在我得到以下输出:

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

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"

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

Answers:




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

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

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

如果文件存在,则只需rmagick使用以下命令进行安装:

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

谢谢。您的建议有效。但是,我现在得到另一个输出(请检查已编辑问题的详细信息)。我不确定“由于某些原因,可能无法创建Makefile,可能缺少必要的库和/或头文件,请检查mkmf.log文件以获取更多详细信息。” 。另外,我是否需要安装输出中提到的开发版本?
拉纳

嗨,是的,我只是确认确实安装了此glibc-headers lib。还有其他线索吗?
拉纳

在上面添加了mkmf.log文件的输出。请检查是否可以找到任何线索。我在Linux和Linux上都是新手,所以很多东西都输给我了:(。也有帮助
拉娜

不,我没有从源代码编译任何软件包。我一直使用“ yum install”或“ gem install”安装打包的库。关于这个问题的答案:stackoverflow.com/questions/14355798/…,您认为对我来说也可能是类似情况吗?rmagick与imagemagick不兼容的版本?
拉纳

1
在Ubuntu 16.04上,它现在是PATH =“ / usr / lib / x86_64-linux-gnu / ImageMagick-6.8.9 / bin-Q16:$ PATH” PKG_CONFIG_PATH = / usr / lib / x86_64-linux-gnu / pkgconfig gem install rmagick -v '2.13.2'
werkshy

7

对于Mac与Brew,简单..

brew install imagemagick

这样便gem install imagemagick可以正常工作。


7

问题是,正如错误所言,

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

那里也建议解决方案:

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

所以,

  1. 查找MagickCore.pc的位置:

    sudo find / -name MagickCore.pc
    
  2. 如果未找到,则可能是您的系统上未安装ImageMagick-然后安装它(Google如何操作,因为它取决于操作系统)

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

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


2
directory containing意味着您必须删除文件名才能起作用。这样PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
sekrett

绝对!谢谢,@ sekrett
谢尔盖·


1

在Debian(不稳定),以解决此错误需要正确的包名libmagickcore-6.q16-devimagemagicklibmagickwand-6-headers

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


0

对于遇到此问题并且100%认真地安装了devkit的Windows用户:

安装时,将提示您 在此处输入图片说明

选择1是不够的。只需按Enter键(1&3),即可正确安装devkit。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.