March 1st, 2013

I’ve rarely needed to dip into Perl over the last few years and so only recently discovered Stawberry Perl.  I’ve been working on a project with Perl 5.8 and discovered you have to pay to install older versions of the Active State Perl kits.  Stawberry Perl comes with a cpan client that has made installing dependencies totally painless until today when I was trying to install Image::Magick.  I followed all the instructions about installing the binaries with headers etc but ended up with the following output:

cpan> install Image::Magick 
Database was generated on Fri, 01 Mar 2013 13:47:23 GMT
Running install for module 'Image::Magick'
Running make for J/JC/JCRISTY/PerlMagick-6.82.0.tar.gz
Checksum for C:\strawberry\cpan\sources\authors\id\J\JC\JCRISTY\PerlMagick-6.82.0.tar.gz ok
Scanning cache C:\strawberry\cpan\build for sizes
..........................--------------------------------------------------DONE
DEL(1/4): C:\strawberry\cpan\build\PerlMagick-6.82-urI0S6
DEL(2/4): C:\strawberry\cpan\build\PerlMagick-6.82-urI0S6.yml
DEL(3/4): C:\strawberry\cpan\build\PerlMagick-6.82-R3WaOt
DEL(4/4): C:\strawberry\cpan\build\PerlMagick-6.82-R3WaOt.yml

  CPAN.pm: Going to build J/JC/JCRISTY/PerlMagick-6.82.0.tar.gz

Gonna create 'libMagickCore.a' from 'C:\Program Files (x86)\ImageMagick-6.8.3-Q16\CORE_RL_magick_.dll'
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lMagickCore-Q16
… [ skip a few lines ] … 
Magick.o:Magick.c:(.text+0x24): undefined reference to `AcquireQuantumMemory' 
… [ lots more errors like the one above ] …
collect2: ld returned 1 exit status
dmake.EXE:  Error code 129, while making 'blib\arch\auto\Image\Magick\Magick.dll'
  JCRISTY/PerlMagick-6.82.0.tar.gz
  C:\strawberry\c\bin\dmake.EXE -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

I tried and failed to find the solution to this on the cpan client.

ppm to the rescue

I was reminded that Strawberry Perl also comes with ppm and this worked straight away:

C:\>ppm 
PPM interactive shell (0.01_02) - type 'help' for available commands. 
PPM> install Image-Magick 
Install package 'Image-Magick?' (y/N): y
 Installing package 'Image-Magick'... 
Bytes transferred: 3203922 
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree 
Installing C:\strawberry\perl\site\lib\auto\Image\Magick\analyze.dll 
… [ skip a few lines ] … 
Installing C:\strawberry\perl\site\lib\Image\Magick.pm

I’d previously found some dependencies installed fine on cpan but not on ppm.

So in conclusion if cpan isn’t working you should give ppm a try and vice versa.