我正在运行一个debian服务器,并在一段时间后升级所有的软件包( apt-get update , apt-get upgrade , apt-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
谁能帮我这个?
—更新1 —
安装一些graphicsmagic的东西后,我进一步了一点:
apt-get install graphicsmagick-libmagick-dev-compat Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libmagick++-6-headers libmagick++-6.q16-dev Use 'apt-get autoremove' to remove them. The following packages will be REMOVED: libmagick++-dev libmagickcore-dev The following NEW packages will be installed: graphicsmagick-libmagick-dev-compat 0 upgraded, 1 newly installed, 2 to remove and 1 not upgraded. Need to get 0 B/26.2 kB of archives. After this operation, 267 kB disk space will be freed. Do you want to continue? [Y/n]
这是bundle install输出:
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 stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... no Can't install RMagick 0.0.0. 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 extconf failed, exit code 1
这对我们有什么帮助吗?
* —更新2 — *
分别安装graphicsmagick-libmagick-dev-compat和libmagickcore-dev ,我尝试安装libmagick++-dev
apt-get install libmagick++-dev Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: graphicsmagick-libmagick-dev-compat The following NEW packages will be installed: libmagick++-dev 0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded. Need to get 0 B/121 kB of archives. After this operation, 115 kB of additional disk space will be used.
问题很简单。 Magick-config在您系统的任何地方都找不到。 当你卸载imagemagick,它也被卸载 – 显然你没有安装imagemagick再次。 要解决此问题,请安装以下软件包:
sudo apt-get install libmagick++-dev graphicsmagick-libmagick-dev-compat libmagickcore-dev
然后重新运行gem安装程序。
对于未来遇到这个问题的人来说,这花了我很长的一段时间,但是它是固定的。 这就是我所做的:
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
可能是您正在安装ImageMagick版本7.xx,它将在您的usr/lib/local/include/ImageMagick7.xx文件夹中生成不同的文件夹名称。
在ImageMagick6.xx版本中,我们有magick , wand命名的文件夹,在ImageMagick7.xx版本中已经命名为这个MagickCore , MagickCore 。 所以这个更新导致这里的一些gem安装问题。 这是使用magick/some_header.h或者wand/some_header.h (意味着它们不会被新的7.xx ImageMagick版本更新)。
这就是为什么我们得到这个错误:
“`
checking for outdated ImageMagick version (<= 6.4.9)... no checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no .... checking for wand/MagickWand.h... no
“`
并在日志文件中是这样的:
error: 'MagickCore/method-attribute.h' file not found #include "MagickCore/method-attribute.h" ^
解
从官方站点: https ://www.imagemagick.org/download/安装ImageMagick6.xx版本并使用以下命令安装(在解压zip / tar之后):
./configure make make install
然后做
gem install rmagick
它会工作。