The problem is due to Image Magick updating their software! How dare they update their code, fix bugs, and make changes which are not backwards compatible with my software that is 5 years old. Deprecated, and completely out of any warranty what-so-ever. Obviously you should strive to update your code to be up-to-date with the latest versions. But sometimes… You just can’t, whether that be because of technical debt, lack of technical know-how, or lazyness.

If you have this problem and want a fix. The answer is to compile an older version of ImageMagick. I’ve successfully installed ImageMagick-6.7.7-10 and rmagick version 2.13.2. Please see the bottom of my post for the fix I used. Continue reading for the the following is my spiral into madness of running old packages on newer operating systems, and attempting to install ImageMagick-7.x (whatever was the latest) and successfully failing.

How to attempt to compile programs for systems that have horrible dependancies

I have a requirement to run a gemset version of 2.3.15 and Rails 1.8.7 on the latest Ubuntu 16.04.2 LTS version. The current version in the Ubuntu apt repository is 6.8.9.9 and results in a lot of issues. Some issues you might get are the following.

  • Compile Error 1: Magick-config not found in $PATH

The first error if you try and compile ImageMagick is regards to Magick-config. That’s because Magick-config is changed to “MagickWand-config” which results in the very descriptive bug:

> gem install rmagick -v 2.13.1
Building native extensions.  This could take a while...
...
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in $(Your $PATH here)

If you then realize this from this helpful stack overflow message and make the updated changes you will get slightly closer. A quick whereis MagickWand-config should get you where you need to go. Here is my example: sudo ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-7.xxx/bin-Q16/MagickWand-config /usr/bin/Magick-config

  • Compile Error 2: checking for wand/MagickWand.h... no
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.

:facepalm:

It’s because the folder “wand” has changed. Which this little guy with 0 points pointed out. “wand” and “magick” have been renamed to “MagickWand and MagicCore” respectively.

So we can cd /usr/lib/x86_64-linux-gnu/ImageMagick-7.0.7-1/include/ImageMagick-7 into our latest awesome version of ImageMagick and perform some linking but then it STILL doesn’t work.

So feel free to copy paste this next line because its purging time!

sudo apt-get purge imagemagick\*

Production is down, and I need a fix now!

The actual fix is downloading ImageMagick v6.7.7.10 from the imagemagick site, extracting it, and compiling without HDRI. You only need to do this if you require ruby gem rmagick v2.13.1, because like me, your stuck “managing” legacy systems.

Please do not do this on production first!

cd /tmp
wget https://www.imagemagick.org/download/releases/ImageMagick-6.7.7-10.tar.xz
tar -xf ImageMagick-6.7.7-10.tar.xz
cd ImageMagick-6.7.7-10
# Disable HDRI as rmagick 2.13.1 can't handle it
./configure --disable-hdri && make -j 8 && sudo make install

Go back to your repository folder and issue:

gem install rmagick -v 2.13.1 && \
bundle install

And all should be well in the world! Please let me know how you went & if you have any issues or thoughts on the matter.