我正在运行一个 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 安装过程。
对于将来遇到此问题的人:我花了很长时间,但已解决。这就是我所做的:
可能您正在安装 ImageMagick 版本 7.xx,它将在您的文件夹中生成不同的文件夹名称
usr/lib/local/include/ImageMagick7.x.x
。在 ImageMagick6.xx 版本中,我们有
magick
,wand
命名文件夹,在 ImageMagick7.xx 版本中命名为MagickCore
,MagickWand
。因此,此更新导致某些 gem 安装出现问题,例如此处。哪个正在使用magick/some_header.h
或wand/some_header.h
(意味着它们没有使用新的 7.xx ImageMagick 版本进行更新)。这就是我们收到此错误的原因:
```
```
在日志文件中是这样的:
解决方案
从官方网站在您的系统中安装 ImageMagick6.xx 版本:https ://www.imagemagick.org/download/并使用以下命令安装它(解压缩 zip/tar 后):
然后做
gem install rmagick
它会起作用的。