views:

372

answers:

2

I'm trying to install a piece of software (moddims) that depends on "Imagemagick 6.3.9+" - I tried installing the latest version of ImageMagick (6.5.4-5) but got the following error when I tried to "make" moddims:

mod_dims_ops.c: In function ‘dims_smart_crop_operation’:
mod_dims_ops.c:34: error: too few arguments to function ‘ParseGravityGeometry’

Presumably the function signature changed somewhere between ImageMagick 6.3.9 and the current version.

I'd like to try installing moddims against the older version of ImageMagick - but I want to install ImageMagick 6.3.9 without interfering with the already-installed 6.5.4-5 version.

What ./configure incantations can I use to a) install the older version of ImageMagick in such a way that it won't over-write or otherwise interfere with my modern version and b) compile moddims to use that older version?

I'm on OSX, but I anticipate having the same problem for when I later need to install moddims on a Linux production server.

+2  A: 

Clearly, you have to obtain, compile and install the older version of ImageMagick.

Faced with this problem - especially since it is at an experimental phase (you don't know for sure you want to keep this version of ImageMagick around) - I would:

  • Create a new directory to install ImageMagick:

    /opt/ImageMagick
    
  • Configure ImageMagick 6.3.9 to install in there - probably:

    ./configure --prefix=/opt/ImageMagick
    
  • Build, test, and install it.

  • Configure moddims to look in the ImageMagick location before standard places:

    export LDFLAGS=-L/opt/ImageMagick/lib
    export CPPFLAGS=-I/opt/ImageMagick/include
    ./configure ....
    
  • Check that the produced moddims code uses your preferred libraries:

    otool -L ...moddims-progam-or-library...    # MacOS X
    ldd ...moddims-program-or-library...        # Linux, etc.
    

The first check will be "does moddims compile when configured"; if it doesn't, you are probably using the 'standard' version of the moddims header file despite this attempt to avoid doing so.

There might also be configure options to specify where the ImageMagick library should be pulled from - check with './configure --help' (and/or 'grep -i image configure').

Jonathan Leffler
Great answer, but for "Configure ImageMagick 6.3.9 to install there" am I right in thinking I need to use "./configure --prefix=/opt/ImageMagick/ --exec-prefix=/opt/ImageMagick/" ?
Simon Willison
Also, why "/opt/ImageMagick" as opposed to somewhere else (like in my own home directory somewhere)? Would it be possible to statically link in the ImageMagick libraries so I can then delete them and not have them cluttering up my filesystem?
Simon Willison
I think I might be screwed... I got the whole lot compiled, but then got "httpd: Syntax error on line 117 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libmod_dims.so into server: dlopen(/usr/libexec/apache2/libmod_dims.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libmod_dims.so: mach-o, but wrong architecture" - I think I need to compile moddims as 64 bit instead of 32 bit, but that means doing the same for ImageMagick, which is throwing nasty errors.
Simon Willison
Posted a follow up question: http://stackoverflow.com/questions/1185287/compiling-imagemagick-as-64bit-under-os-x
Simon Willison
Why /opt/ImageMagick? Why not - you may choose any location, and $HOME/lib/ImageMagick would be fine. Running configure: yes, you should add --prefix=/opt/ImageMagick (or whereever else you choose).
Jonathan Leffler
+1  A: 

Since ImageMagick uses pkg-config. All you need to do is adjust your PKG_CONFIG_PATH to reference the old version. (This assumes that your package invokes PKG_CHECK_MODULES to configure itself for ImageMagick. If your package does not do that, you should modify it so that it does.)

Basically, you want to grab the old ImageMagick and install it somewhere (eg ./configure --prefix=$HOME/obsolete && make install), then go to your package and configure with the argument PKG_CONFIG_PATH=$HOME/obsolete/lib/pkgconfig. Unfortunately, ImageMagick will install files outside of your specified prefix (eg in /Library/perl ), so this is not guaranteed to not modify your current library. (IMO, this is an ImageMagick packaging bug.)

Check the pkg-config documentation for details.

William Pursell