Can't install rmagick gem on Ubuntu 13.04

11,740

Solution 1

Solution is to add ppa where those libs could be found.

Add PPA:

sudo add-apt-repository ppa:ricotz/testing

Then update package list:

sudo apt-get update

Finally install it with:

sudo apt-get install libmagickwand-dev

Solution 2

try this out

first install imagemagick

sudo apt-get install imagemagick

and then

sudo apt-get install libmagickwand-dev

Solution 3

Try clearing your apt repository and removing any broken packages first:

sudo apt-get update
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove

If the system identifies any broken packages, forcefully remove them (replace package_name with your own):

sudo dpkg --remove -force --force-remove-reinstreq package_name

Then reinstall any missing packages again.

Share:
11,740
Иван Бишевац
Author by

Иван Бишевац

Software engineer

Updated on June 07, 2022

Comments

  • Иван Бишевац
    Иван Бишевац almost 2 years

    When I try to install rmagic with:

    gem install rmagic
    

    it gives error:

    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
    

    I tried to search for problem and found that I am missing libmagickwand-dev. I tried to install it with:

    sudo apt-get install libmagickwand-dev
    

    but it raises error:

    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.
    

    If I try to install it with:

    sudo apt-get install libmagickcore-dev
    

    it gives error:

    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.
    

    If I try to install it with:

    sudo apt-get install librsvg2-dev
    

    it gives error:

    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.
    

    If I try to install libglib2.0-dev with:

    sudo apt-get install libglib2.0-dev
    

    it gives error:

    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.
    

    If I install libglib2.0-0 with:

    sudo apt-get install libglib2.0-0
    

    it gives:

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

    If I install libglib2.0-bin with:

    sudo apt-get install libglib2.0-bin
    

    it gives:

    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.
    

    Those 2 libs are installed but issuing again:

    sudo apt-get install libglib2.0-dev
    

    it gives same error:

    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.
    

    What could be problem here?

    I am using Ubuntu 13.04, rbenv, ruby 2.0.0, if that matters.

  • Aleks
    Aleks almost 10 years
    wow, and you gave the exact solution that I needed! the add-apt solved the problem and the rest of the steps. thanks!
  • Sumit Munot
    Sumit Munot almost 10 years
    After all above solutions failed for me..I just Googled and found above blog. works perfectly..
  • Иван Бишевац
    Иван Бишевац almost 10 years
    Probably you have other Ubuntu version, or meanwhile Ubuntu added libmagickwand-dev to 13.10 repositories.
  • Иван Бишевац
    Иван Бишевац almost 10 years
    Which is your Ubuntu version?
  • Sumit Munot
    Sumit Munot almost 10 years
    Ubuntu version 13.04...:)
  • heemin
    heemin almost 10 years
    Thanks! The order was important.
  • robvelor
    robvelor about 9 years
    I was having this issue too having installed libmagickwand-dev only. Once I installed imagemagick, the gem compiled with no problems.
  • Steve Upstill
    Steve Upstill over 8 years
    That's NOT sufficient, at least on Ubuntu 12.04. It failed repeatedly until I installed imagemagick first.
  • Steve Upstill
    Steve Upstill over 8 years
    I tried libmagickwand-dev repeatedly (with remove and autoremove betweentimes), and it repeatedly failed. Installing imagemagick first was a magic bullet. THANK YOU!