1

I'm running a debian server and upgraded all packages after quite a while (apt-get update, apt-get upgrade, apt-get distro-upgrade). Then rmagick didn't work anymore becuase imagemagick was updated.

So I ran:

gem uninstall rmagick
bundle install

Then I got this:

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.

This is 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

Can anyone help me with this?

--- UPDATE 1 ---

After installing some graphicsmagic stuff, I got a little further:

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]

This is bundle install output:

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

Does this help us in any way?

* --- Update 2 --- *

After installing graphicsmagick-libmagick-dev-compat and libmagickcore-dev separately, I tried to install 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.
Cojones
  • 123
  • 3
  • 9

3 Answers3

2

The problem is simple. Magick-config is not found anywhere on your system. When you uninstalled imagemagick, it was also uninstalled - and apparently you didn't install it with imagemagick again. To solve this, install the following package:

sudo apt-get install libmagick++-dev graphicsmagick-libmagick-dev-compat libmagickcore-dev

Then rerun the gem install procedure.

Linostar
  • 157
  • 7
  • Hey, thanks for the tip. It was missing but didn't solve the problem :( Same error message. Do I need to restart any server or service in order to get it properly reloaded or something? – Cojones Feb 09 '15 at 10:52
  • You may have other packages missing. I updated my answer adding two more packages to the *apt-get install* command. – Linostar Feb 09 '15 at 11:02
  • No success, installed all of them :( However, I found something else out, see my updated question. Also your comment above doesn't work like this. `graphicsmagick-libmagick-dev-compat` removes the other ones because they conflict each other. – Cojones Feb 09 '15 at 12:42
  • That's another package missing :). Hang on, almost there! `sudo apt-get install libmagickwand-dev` – Linostar Feb 09 '15 at 13:56
  • First of all, thanks a lot for trying to help me! You're gonna be worth the whole 50 points if you succeed :) Anyways, see update 2 in the answer. – Cojones Feb 09 '15 at 16:11
  • You're welcome. Keep/re-install `graphicsmagick-libmagick-dev-compat` and let it remove `libmagick++-dev`. Try your `gem install` then. – Linostar Feb 09 '15 at 16:18
  • Ok, after doing both, I get `checking for wand/MagickWand.h... no Can't install RMagick 0.0.0. Can't find MagickWand.h.` Is this an improvement? :) – Cojones Feb 09 '15 at 19:51
  • Make sure that `libmagickwand-dev` is installed. If it is installed and you're still facing the same problem, search for the missing `MagickWand.h` in your system. If you find it in `/usr/include/ImageMagick/wand/MagickWand.h`, make sure to include that in your library path by typing: `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/include/ImageMagick` – Linostar Feb 09 '15 at 20:10
  • It was `/usr/include/ImageMagick-6` instead of `/usr/include/ImageMagick`, so I created a symlink. I ran export but with same result: `Can't find MagickWand.h.` Since it can't find `MagickWand.h`, this is the file folder `lrwxrwxrwx 1 root root 19 Sep 27 17:25 wand -> GraphicsMagick/wand`. Is it supposed to be a symlink to GraphicsMagick? Also, there is no `MagickWand.h` in that folder? – Cojones Feb 10 '15 at 09:12
  • Simlink `/usr/include/ImageMagick-6` to `/usr/include/ImageMagick`, not the `wand` folder. – Linostar Feb 10 '15 at 09:22
  • I did already: `lrwxrwxrwx 1 root root 26 Feb 10 10:06 /usr/include/ImageMagick -> /usr/include/ImageMagick-6`. I didn't link the wand folder there, that was probably GraphicsMagick. – Cojones Feb 10 '15 at 11:25
  • Any other ideas? You're kinda my last resort. – Cojones Feb 11 '15 at 12:18
  • My last thought: perhaps the reason is that pkgconfig isn't picking up the newly installed packages. Reinstall pkg-config using `sudo apt-get install --reinstall pkg-config`, then type: `export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH` – Linostar Feb 11 '15 at 12:28
  • No success, tried it over and over again. I ran out of ideas and not sure how to proceed. Is there maybe an alternative to rmagick I can use? Couldn't find one so far. – Cojones Feb 13 '15 at 11:19
0

For whoever runs into this problem in the future: It took me long but it's fixed. This is what I did:

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
olmstad
  • 197
  • 1
  • 6
Cojones
  • 123
  • 3
  • 9
0

May be you are installing ImageMagick version 7.x.x which will generate different folder names in your usr/lib/local/include/ImageMagick7.x.x folder.

In ImageMagick6.x.x version we have magick, wand named folders, where in ImageMagick7.x.x version have named this MagickCore , MagickWand . So this updation is causing the problem in some gem installation like here. Which is using magick/some_header.h or wand/some_header.h (Means they are not updated with the new 7.x.x ImageMagick version).

That's why we are getting this error :

```

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

```

and in log file something like this :

error: 'MagickCore/method-attribute.h' file not found
#include "MagickCore/method-attribute.h"
         ^

Solution

Install the ImageMagick6.x.x version in your system from the official site : https://www.imagemagick.org/download/ and install it using this commands(after extract zip/tar) :

./configure
make 
make install

Then do

gem install rmagick

It will work.

  • Hey, I tried this and the gem did install, but now I'm getting this error: `libMagickCore-6.Q16.so.6: cannot open shared object file: No such file or directory - /home/app/.rvm/gems/ruby-2.6.2/gems/rmagick-3.0.0/lib/RMagick2.so (LoadError)` when the file does exist – Amrit Kahlon Jun 14 '19 at 00:25
  • You may also need to set the following symbolic links here before it can work: ``` ln -s /usr/local/lib/libMagickWand-6.Q16.so.6 /home/marcelo/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/rmagick-2.16.0/libMagickWand-6.Q16.so.6 sudo ln -s /usr/local/lib/libMagickWand-6.Q16.so.6 /usr/lib ln -s /usr/local/lib/libMagickCore-6.Q16.so.6 /home/marcelo/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/rmagick-2.16.0/libMagickCore-6.Q16.so.6 sudo ln -s /usr/local/lib/libMagickCore-6.Q16.so.6 /usr/lib ``` – Shekhar Prasad Rajak Jun 18 '19 at 05:31