News

Welcome to End Point’s blog

Ongoing observations by End Point people

Building ImageMagick on RHEL/CentOS 6 with Perl 5.18.1

This is a quick tip for anyone in the exact same situation I was recently, and everyone else can probably just skip it!

RHEL 6 and CentOS 6 and other derivatives come with ImageMagick-6.5.4.7-6.el6_2.x86_64, which is a bit dated but still reasonable. They also come with Perl 5.10.1, which has grown very old. We wanted to use the latest version of Perl (5.18.1) with plenv, but the latest version of the Perl libraries for ImageMagick (PerlMagick) does not work with the older ImageMagick 6.5.4.7.

The first task, then, was to locate the matching older version of PerlMagick from BackPAN, the archive of historical CPAN modules: http://backpan.perl.org/authors/id/J/JC/JCRISTY/PerlMagick-6.54.tar.gz, and try to build that.

However, that fails to build without applying a patch to make it compatible with newer versions of Perl. The patch is available from http://trac.imagemagick.org/changeset?format=diff&new=4950, or you can just create a file called typemap in the root of the unpacked directory, with one line:

Image::Magick T_PTROBJ

Then build, test, and install as usual. That's it.

3 comments:

targ said...

The perl interface for ImageMagick sucks because the maintainer completely ignores any bugreport on RT and fails to account for the fact that other package managers install to different prefixes. Very few people can install from cpan without manual intervention.

Dmitry Karasik said...

After numerous attempts and cursing, I found the only way to install PerlMagick properly is to match its and Imagemagick versions exactly, which excludes CPAN interface. When I need it installed I download the source from imagemagick.org, and compile it from there. I believe the current state of affairs is that PerlImagick is found on CPAN is misleading at best. I wish Makefile.PL would've provided a courtesy and failed gracefully if versions don't match.

Jon Jensen said...

Yes, PerlMagick must be matched exactly to the ImageMagick version, so installing with the cpan/cpanm clients usually won't work. I linked the BackPAN in the article, which is where you can find the correct older matching PerlMagick version.