Installing RMagick 2 on CentOS/RHEL 5 it’s not that hard, you just need to install ImageMagick newer than 6.3.5 (CentOS/RHEL 5 is shipping ImageMagick 6.2.8) and that’s the hardest part of the job.
[root@silver ~]# gem install rmagick Building native extensions. This could take a while... ERROR: Error installing rmagick: 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... yes checking for ImageMagick version >= 6.3.5... no Can't install RMagick 2.12.2. You must have ImageMagick 6.3.5 or later.
I’ve tried to avoid ImageMagick upgrade and to install RMagick 1, but RMagick 1 failed to install with a strange compile error, probably because the gcc compliler shipped with CentOS/RHEL 5 is too new for version 1.
I didn’t wanted to patch RMagick 1, neither to install from sources (I do prefer RPM packages). So, I’ve decided to upgrade ImageMagick library to satisfy RMagick 2 requirements.
Subscribe your system to the following repositories:
Install the following packages:
[root@silver ~]# yum --enablerepo=epel --enablerepo=rpmforge --enablerepo=centosplus install djvulibre-devel libwmf-devel jasper-devel libtool-ltdl-devel librsvg2-devel openexr-devel graphviz-devel gcc gcc-c++ ghostscript freetype-devel libjpeg-devel libpng-devel giflib-devel libwmf-devel libexif-devel libtiff-devel
Add “–noplugins” if you are using “yum-priorities”, or it will fail to install packages.
Download ImageMagick.spec to your SPECS directory and ImageMagick-6.5.7-0.tar.bz2 to SOURCES directory and then rebuild the rpm using rpmbuild:
[root@silver SPECS]# rpmbuild -ba ImageMagick.spec [...]
Or just grab the source RPM from here:
http://red.penguin.ro/SRPMS/ImageMagick-6.5.7-0.src.rpm
and build it:
[root@silver ~]# rpmbuild --rebuild ImageMagick-6.5.7-0.src.rpm Installing ImageMagick-6.5.7-0.src.rpm warning: user vitalie does not exist - using root warning: group vitalie does not exist - using root warning: user vitalie does not exist - using root warning: group vitalie does not exist - using root Executing(%prep): /bin/sh -e /home/worf/rpmbuild/tmp/rpm-tmp.11936 + umask 022 + cd /home/worf/rpmbuild/BUILD + LANG=C + export LANG + unset DISPLAY + cd /home/worf/rpmbuild/BUILD + rm -rf ImageMagick-6.5.7-0 + /usr/bin/bzip2 -dc /home/worf/rpmbuild/SOURCES/ImageMagick-6.5.7-0.tar.bz2 + tar -xf - [...] Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires: /bin/sh ImageMagick-c++ = 6.5.7-0 ImageMagick-devel = 6.5.7-0 libMagick++.so.2()(64bit) Processing files: ImageMagick-debuginfo-6.5.7-0 Provides: Magick.so.debug()(64bit) analyze.so.debug()(64bit) art.so.debug()(64bit) avi.so.debug()(64bit) avs.so.debug()(64bit) bmp.so.debug()(64bit) braille.so.debug()(64bit) cals.so.debug()(64bit) caption.so.debug()(64bit) cin.so.debug()(64bit) cip.so.debug()(64bit) clip.so.debug()(64bit) cmyk.so.debug()(64bit) cut.so.debug()(64bit) dcm.so.debug()(64bit) dds.so.debug()(64bit) dib.so.debug()(64bit) djvu.so.debug()(64bit) dng.so.debug()(64bit) dot.so.debug()(64bit) dpx.so.debug()(64bit) ept.so.debug()(64bit) fax.so.debug()(64bit) fits.so.debug()(64bit) gif.so.debug()(64bit) gradient.so.debug()(64bit) gray.so.debug()(64bit) hald.so.debug()(64bit) histogram.so.debug()(64bit) hrz.so.debug()(64bit) html.so.debug()(64bit) icon.so.debug()(64bit) info.so.debug()(64bit) inline.so.debug()(64bit) ipl.so.debug()(64bit) jp2.so.debug()(64bit) jpeg.so.debug()(64bit) label.so.debug()(64bit) libMagick++.so.2.0.0.debug()(64bit) libMagickCore.so.2.0.0.debug()(64bit) libMagickWand.so.2.0.0.debug()(64bit) magick.so.debug()(64bit) map.so.debug()(64bit) mat.so.debug()(64bit) matte.so.debug()(64bit) meta.so.debug()(64bit) miff.so.debug()(64bit) mono.so.debug()(64bit) mpc.so.debug()(64bit) mpeg.so.debug()(64bit) mpr.so.debug()(64bit) msl.so.debug()(64bit) mtv.so.debug()(64bit) mvg.so.debug()(64bit) null.so.debug()(64bit) otb.so.debug()(64bit) palm.so.debug()(64bit) pattern.so.debug()(64bit) pcd.so.debug()(64bit) pcl.so.debug()(64bit) pcx.so.debug()(64bit) pdb.so.debug()(64bit) pdf.so.debug()(64bit) pict.so.debug()(64bit) pix.so.debug()(64bit) plasma.so.debug()(64bit) png.so.debug()(64bit) pnm.so.debug()(64bit) preview.so.debug()(64bit) ps.so.debug()(64bit) ps2.so.debug()(64bit) ps3.so.debug()(64bit) psd.so.debug()(64bit) pwp.so.debug()(64bit) raw.so.debug()(64bit) rgb.so.debug()(64bit) rla.so.debug()(64bit) rle.so.debug()(64bit) scr.so.debug()(64bit) sct.so.debug()(64bit) sfw.so.debug()(64bit) sgi.so.debug()(64bit) stegano.so.debug()(64bit) sun.so.debug()(64bit) svg.so.debug()(64bit) tga.so.debug()(64bit) thumbnail.so.debug()(64bit) tiff.so.debug()(64bit) tile.so.debug()(64bit) tim.so.debug()(64bit) ttf.so.debug()(64bit) txt.so.debug()(64bit) uil.so.debug()(64bit) url.so.debug()(64bit) uyvy.so.debug()(64bit) vicar.so.debug()(64bit) vid.so.debug()(64bit) viff.so.debug()(64bit) wbmp.so.debug()(64bit) wmf.so.debug()(64bit) wpg.so.debug()(64bit) x.so.debug()(64bit) xbm.so.debug()(64bit) xc.so.debug()(64bit) xcf.so.debug()(64bit) xpm.so.debug()(64bit) xps.so.debug()(64bit) xwd.so.debug()(64bit) ycbcr.so.debug()(64bit) yuv.so.debug()(64bit) Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/worf/rpmbuild/tmp/ImageMagick-6.5.7-0-root-root Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-6.5.7-0.x86_64.rpm Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-devel-6.5.7-0.x86_64.rpm Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-doc-6.5.7-0.x86_64.rpm Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-perl-6.5.7-0.x86_64.rpm Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-c++-6.5.7-0.x86_64.rpm Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-c++-devel-6.5.7-0.x86_64.rpm Wrote: /home/worf/rpmbuild/RPMS/x86_64/ImageMagick-debuginfo-6.5.7-0.x86_64.rpm Executing(%clean): /bin/sh -e /home/worf/rpmbuild/tmp/rpm-tmp.25482 + umask 022 + cd /home/worf/rpmbuild/BUILD + cd ImageMagick-6.5.7-0 + rm -rf /home/worf/rpmbuild/tmp/ImageMagick-6.5.7-0-root-root + exit 0 Executing(--clean): /bin/sh -e /home/worf/rpmbuild/tmp/rpm-tmp.25482 + umask 022 + cd /home/worf/rpmbuild/BUILD + rm -rf ImageMagick-6.5.7-0 + exit 0
Uninstall i386 ImageMagick libraries if you are on x86_64 system:
[root@silver ~]# rpm -qa | grep ImageMagick | grep -i i386 | xargs rpm -e
Install the new RPMs compiled in the previous steps:
[root@silver x86_64]# rpm -Uvh ImageMagick-6.5.7-0.x86_64.rpm ImageMagick-c++-6.5.7-0.x86_64.rpm ImageMagick-c++-devel-6.5.7-0.x86_64.rpm ImageMagick-devel-6.5.7-0.x86_64.rpm
Finally, install the RMagick 2 plugin:
[root@silver ~]# gem install rmagick --no-rdoc --no-ri Building native extensions. This could take a while... Successfully installed rmagick-2.12.2 1 gem installed
10 comments ↓
Thanks so much for posting this – you’re a lifesaver, I wouldn’t have been able to get past this showstopper without this post!
Thank you very much, that was a great help and saved me a lot of time.
[...] of ImageMagick, a custom build from source, lacked proper PNG support. A bit of searching uncovered this excellent guide to installing it from a source RPM – but I had a few modifications to those instructions so [...]
By any chance, is it possible to download the binary rpm you have generated ?
Sure, you can download them here:
http://red.penguin.ro/RPMS/
Thank you very much, I found this is best Artical for ImageMagick on RHEL5/CentOS5.
Thanks Again
Incredible! It worked on Centos 5.4.
Just a note :
I stumbled upon a conflict for graphviz-devel between EPEL and RPMFORGE versions (the RPMFORGE one is what I needed) . I had to remove it from the line:
yum –enablerepo=epel –enablerepo=rpmforge –enablerepo=centosplus install djvulibre-devel libwmf-devel jasper-devel libtool-ltdl-devel librsvg2-devel openexr-devel gcc gcc-c++ ghostscript freetype-devel libjpeg-devel libpng-devel giflib-devel libwmf-devel libexif-devel libtiff-devel
Then adding it alone disabling epel repository:
yum –disablerepo=epel install graphviz-devel
Thanks a lot!
Although I followed successfully all the steps of your tutorial, gem install rmagick still returns error about lMagick and lMagickCore. I’m on a CentOS 5 machine and I’ve spend many many hours with this error.
Please any ideas?
/usr/local/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.3.5… 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… yes
checking for InitializeMagick() in -lMagickCore… no
checking for InitializeMagick() in -lMagick… no
Can’t install RMagick 2.12.2. Can’t find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.
Check that you have installed devel packages on your machine:
rpm -qa | grep -i ‘^ImageMagick’ | grep devel
ImageMagick-devel
ImageMagick-c++-devel
This was a great help, thanks. It’s probably my newbie-ness, but things didn’t work out for me as easy as copy and paste, so I put how I did it on CentOS 5.5, i386 machine here: http://goo.gl/0BQc
Leave a Comment