【问题标题】:"rmagick" gem installation issue“rmagick”gem 安装问题
【发布时间】:2013-05-22 09:19:23
【问题描述】:

我在尝试在 centos 上安装“rmagick”gem 时遇到问题。以下是我的输出。谁能帮我确定我缺少什么包?我已经安装了所有提到的另一个堆栈溢出线程:RMagick install error

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 的输出与上面的终端输出相同。

【问题讨论】:

    标签: ruby gem


    【解决方案1】:

    对于遇到此问题并且 100% 确信他们已安装 devkit 的 Windows 用户:

    安装时会出现这个提示

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

    【讨论】:

      【解决方案2】:

      问题是,正如错误所说,

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

      那里也提出了解决方案:

      将包含MagickCore.pc 的目录添加到PKG_CONFIG_PATH 环境变量中

      所以,

      1. 找到 MagickCore.pc 位置:

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

      3. 像这样将它保存到 ENV var 中(确保将在步骤 1 中找到的路径放入):

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

      【讨论】:

      • directory containing 表示您必须删除文件名才能使其正常工作。所以PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig.
      • 绝对!谢谢,@sekrett
      【解决方案3】:

      这个ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h 适用于 Rmagick 2.16。

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

      【讨论】:

      • 如果您使用自制软件并遇到 ImageMagick7 问题,这是正确答案。
      • brew link --force imagemagick@6帮我安装了gem dhash。
      【解决方案4】:

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

      brew install imagemagick

      那么gem install imagemagick就可以顺利运行了。

      【讨论】:

        【解决方案5】:

        在 debian(不稳定)上,解决此错误所需的正确软件包是 libmagickcore-6.q16-devimagemagicklibmagickwand-6-headers

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

        【讨论】:

          【解决方案6】:

          尝试安装

            sudo apt-get install libmagickwand-dev imagemagick
          

          【讨论】:

          • 看起来很有希望,但仅限于 ubuntu
          • 在 ubuntu 12.04 上工作
          • @Sławosz 你在这里:yum install ImageMagick-devel ImageMagick
          • 使用 yum 在 CentOS 7 上工作。谢谢。
          • 对于MacOS,请看下面我的回答。
          【解决方案7】:

          您似乎没有丢失任何包裹。错误信息很重要:

          也许你应该添加包含 `MagickCore.pc' 的目录 到 PKG_CONFIG_PATH 环境变量

          this superuser duplicate 上的几个答案给出了很好的建议。

          【讨论】:

            【解决方案8】:

            错误信息说:

            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 文件来构建扩展。如果您使用yum 安装了包ImageMagick-devel,则该文件应位于/usr/lib/pkgconfig/usr/lib64/pkgconfig 目录中(取决于您的架构)。用这个命令检查(从现在开始我假设你在 amd64 机器上,如果不是这种情况,请将 lib64 替换为 lib):

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

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

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

            【讨论】:

            • 谢谢。你的建议奏效了。但是,我现在得到另一个输出(请检查编辑的问题详细信息)。我不确定如何处理“由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件。请查看 mkmf.log 文件以获取更多详细信息。” .另外,我需要安装输出中提到的开发版本吗?
            • 嗨,是的,我刚刚确认确实安装了这个 glibc-headers 库。还有其他线索吗?
            • 在上面添加了 mkmf.log 文件的输出。请检查您是否可以找到任何线索。我也是这些和 linux 的新手,所以丢失了很多,输出对我来说意义不大:(。另外,如果你能给我一个安装 RMagick 的描述性指南链接,我可以从头开始,这将是很棒的也有帮助。
            • 不,我没有从源代码编译任何包。我一直使用 "yum install" 或 "gem install" 安装打包的库。这个问题的答案:stackoverflow.com/questions/14355798/…,你认为这对我来说也可能是类似的情况吗? rmagick 版本与 imagemagick 不兼容?
            • 在 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'
            猜你喜欢
            • 2013-10-02
            • 2011-06-21
            • 1970-01-01
            • 2011-10-06
            • 1970-01-01
            • 2023-03-17
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多