ruby-on-rails - 无法在 Ubuntu 13.04 上安装 rmagick gem

标签 ruby-on-rails ruby ubuntu imagemagick rmagick

当我尝试安装 rmagic 时:

gem install rmagic

它给出了错误:

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /home/biske/.rbenv/versions/2.0.0-p247/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... 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=/home/biske/.rbenv/versions/2.0.0-p247/bin/ruby


Gem files will remain installed in /home/biske/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2 for inspection.
Results logged to /home/biske/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

我试图搜索问题,发现我缺少 libmagickwand-dev。我尝试安装它:

sudo apt-get install libmagickwand-dev

但它会引发错误:

The following packages have unmet dependencies:
 libmagickwand-dev : Depends: libmagickcore-dev (= 8:6.7.7.10-5ubuntu2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如果我尝试安装它:

sudo apt-get install libmagickcore-dev

它给出了错误:

The following packages have unmet dependencies:
 libmagickcore-dev : Depends: librsvg2-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如果我尝试安装它:

sudo apt-get install librsvg2-dev

它给出了错误:

The following packages have unmet dependencies:
 librsvg2-dev : Depends: libglib2.0-dev (>= 2.24.0) but it is not going to be installed
                Depends: libgdk-pixbuf2.0-dev (>= 2.23.5-2) but it is not going to be installed
                Depends: libcairo2-dev (>= 1.2.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

如果我尝试安装 libglib2.0-dev:

sudo apt-get install libglib2.0-dev

它给出了错误:

The following packages have unmet dependencies:
 libglib2.0-dev : Depends: libglib2.0-0 (= 2.36.0-1ubuntu1) but 2.36.0-1ubuntu2 is to be installed
                  Depends: libglib2.0-bin (= 2.36.0-1ubuntu1)
E: Unable to correct problems, you have held broken packages.

如果我安装 libglib2.0-0:

sudo apt-get install libglib2.0-0

它给出:

libglib2.0-0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

如果我使用以下命令安装 libglib2.0-bin:

sudo apt-get install libglib2.0-bin

它给出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libglib2.0-bin is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

这 2 个库已安装但再次发布:

sudo apt-get install libglib2.0-dev

它给出了同样的错误:

The following packages have unmet dependencies:
 libglib2.0-dev : Depends: libglib2.0-0 (= 2.36.0-1ubuntu1) but 2.36.0-1ubuntu2 is to be installed
                  Depends: libglib2.0-bin (= 2.36.0-1ubuntu1)
E: Unable to correct problems, you have held broken packages.

这里可能有什么问题?

如果重要的话,我正在使用 Ubuntu 13.04、rbenv、ruby 2.0.0。

最佳答案

试试这个

首先安装imagemagick

sudo apt-get install imagemagick

然后

sudo apt-get install libmagickwand-dev

关于ruby-on-rails - 无法在 Ubuntu 13.04 上安装 rmagick gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18293580/

相关文章:

ruby-on-rails - 如何验证和解析带有用户时区的 ISO 8601 时间戳?

ruby-on-rails - Ruby On Rails 具有业务逻辑的路由

mysql - 在 Ruby on Rails 中动态连接到第二个 MySQL 数据库

Ruby 脚本不会将 POST 请求的主体发送到服务器

linux - 使用 sudo apt-get 时出错

django - 如何在 virtualenv 中为 Celery (django-celery) 编写 Ubuntu Upstart 作业

ruby-on-rails - 尝试安装 libv8 v3.11.8.9 时如何解决此问题?

已安装 Mysql2 gem 但不是必需的

ruby-on-rails - Haml::Engine.render 不会将 block 中的内容放入适当的包含元素中

python - 在 ubuntu 中安装 imutils