在ubuntu 14.04上安装rmagick gem

时间:2014-09-29 18:34:10

标签: ruby-on-rails ubuntu-14.04 aws-opsworks

我试图在OpsWorks上部署应用程序,但是安装rmagick gem时出现问题。我有以下操作系统包:

  

libmagickwand-dev imagemagick libmagickcore-dev

以下是部署期间出错的日志文件:

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 /home/deploy/.bundler/myapp/ruby/2.1.0/gems/rmagick-2.13.3 for inspection.
Results logged to /home/deploy/.bundler/myapp/ruby/2.1.0/extensions/x86_64-linux/2.1.0/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.
STDERR:
---- End output of sudo su - deploy -c 'cd /srv/www/myapp/releases/20140929182350 && /usr/local/bin/bundle install --path /home/deploy/.bundler/myapp --without=test development' 2>&1 ----
Ran sudo su - deploy -c 'cd /srv/www/myapp/releases/20140929182350 && /usr/local/bin/bundle install --path /home/deploy/.bundler/myapp --without=test development' 2>&1 returned 5
[2014-09-29T18:24:08+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

7 个答案:

答案 0 :(得分:26)

在shell中,运行以下命令:

apt-get install libmagickwand-dev

答案 1 :(得分:8)

将ubuntu升级到15.05之后我遇到了同样的问题,Magick-config文件不再出现在我的PATH中了。 为了解决这个问题,我首先找到了Magick-config

的位置

sudo find / -name "Magick-config"

/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config然后我将它添加到路径中。随后Bundle成功了。

答案 2 :(得分:3)

sudo apt-get install libmagickwand5 libmagickwand-dev
gem install rmagick -v 2.13.3

答案 3 :(得分:3)

安装Imagemagick-dev库

Ubuntu系统:sudo apt-get install libmagickwand-dev

RHEL系统:yum install ImageMagick-devel

Mac:brew install imagemagick

答案 4 :(得分:2)

在Ubuntu 14.04中,我还需要安装libgmp-dev库以使用更新的rmagick 2.15.4版本:

sudo apt-get install libgmp-dev

希望这有帮助!

答案 5 :(得分:0)

永久修复它我们可以做到:

ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config

答案 6 :(得分:0)

首先我们需要搜索配置

sudo find / -name "Magick-config"

您将获得如下输出:

/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config

现在您只需要在您的环境中设置bin位置:

PATH=$PATH:/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/

不要忘记从行尾删除Magick-config。