无法安装RMagick 0.0.0。无法找到Magick-config

时间:2015-02-04 14:58:45

标签: ruby-on-rails imagemagick rmagick

我正在运行debian服务器并在很长一段时间后升级所有软件包(apt-get updateapt-get upgradeapt-get distro-upgrade)。然后rmagick不再工作因为imagemagick已更新。

所以我跑了:

gem uninstall rmagick
bundle install

然后我明白了:

Gem::Ext::BuildError: 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... no
Can't install RMagick 0.0.0. Can't find Magick-config in /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

*** 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

extconf failed, exit code 1

Gem files will remain installed in /srv/www/www.example.com/shared/vendor/bundle/ruby/2.1.0/gems/rmagick-2.13.3 for inspection.
Results logged to /srv/www/www.example.com/shared/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/rmagick-2.13.3/gem_make.out
An error occurred while installing rmagick (2.13.3), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.3'` succeeds before bundling.

这是cat mkmf.log

    checking for Ruby version >= 1.8.5... -------------------- yes

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

find_executable: checking for gcc... -------------------- yes

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

find_executable: checking for Magick-config... -------------------- no

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

Can't install RMagick 0.0.0. Can't find Magick-config in /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

任何人都可以帮我吗?

6 个答案:

答案 0 :(得分:21)

对于将来遇到这个问题的人:我花了很长时间才修好了。这就是我所做的:

  • sudo apt-get purge imagemagick libmagickcore-dev libmagickwand-dev
  • sudo rm -R /usr/include/ImageMagick-6/magick
  • sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
  • sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

答案 1 :(得分:1)

我认为你必须从ubuntu存档安装libmagickwand-dev:

该软件包包含使用MagickWand编译程序所需的静态库。它包含MagickWand.h文件

这是一个依赖于默认量子libmagickwand开发文件的转换包。

sudo apt-get install libmagickwand-dev

安装此依赖项后,您需要安装rmagick:

gem install rmagick

答案 2 :(得分:1)

apt-get install libmagickcore-dev对我很有用

答案 3 :(得分:1)

我在Mac OS上,但是我必须指定版本6

brew install imagemagick@6
brew link --overwrite --force imagemagick@6

答案 4 :(得分:1)

在centos 7中,我必须执行以下操作才能使其工作:

 yum install ImageMagick-devel.x86_64

在未安装此软件包的所有时间都失败。

答案 5 :(得分:0)

有相同的问题,但已安装ImageMagic。符号链接有效,但网址与上面的答案略有不同。请注意上限。对于Ubuntu 18.04,有2个选项:

选项1:

添加符号链接:

sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16/Magick-config /usr/bin/Magick-config

选项2:

〜/ .profile中的导出路径

export PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16/:$PATH"