Installing PerlMagick on Windows 7 with Strawberry perl

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
wslab
Posts: 1
Joined: 2012-06-23T23:56:35-07:00
Authentication code: 13

Installing PerlMagick on Windows 7 with Strawberry perl

Post by wslab » 2012-06-24T00:30:46-07:00

I was trying to install PerlMagick on my Windows 7 machine, I and run into some problems. Here's what I ended up doing, maybe it will help somebody.

Setup:
- Windows 7 professional 64bit
- Strawberry Perl 5.14.2 64bit (perl -v output: This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x64-multi-thread)
- ImageMagick: ImageMagick-6.7.7-8-Q16-windows-x64-dll.exe 64bit dynamic with libraries and header files installed.

When trying to install PerlMagick using cpan, I was getting:

Code: Select all

################################### WARNING! ###################################
# It seems that you are trying to install Perl::Magick on a MS Windows box with
# perl + gcc compiler (e.g. strawberry perl), however we cannot find ImageMagick
# binaries installed on your system.
...
followed by a bunch of errors.

So Makefile.PL could not find my installation of ImageMagick. Turns out if was not looking in the right place. Go to the cpan build directory, C:\strawberry\cpan\build\PerlMagick-6.77-xyzxyz (replace C:\strawberry with your own location if your strawberry perl is installed elsewhere and note that "xyzxyz" will be a random character sequence). Open Makefile.PL and add the following 3 lines after line 47:

Code: Select all

push @l, catfile($dirpath, 'lib');
push @b, $dirpath;
push @i, catfile($dirpath, 'include');
Lines 47-50 should look like this:

Code: Select all

47: # try to detect 'lib' dir
48: push @l, catfile($dirpath, 'lib');
49: push @b, $dirpath;
50: push @i, catfile($dirpath, 'include');
Save the file and run "perl Makefile.PL". You should see something like this:

Code: Select all

Gonna create 'libMagickCore.a' from 'C:\Program Files\ImageMagick-6.7.7-Q16\CORE_RL_magick_.dll'
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
Now open the file "Makefile". Scroll down to around line 989 with the comment "MakeMaker pm_to_blib section". A couple of lines below it will be a few lines that looks like this:

Code: Select all

pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
	$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e "pm_to_blib({{@ARGV}}, '$(INST_LIB)\auto', q[$(PM_FILTER)], '$(PERM_DIR)')" -- \
	  Magick.pm $(INST_LIB)\Image\Magick.pm 
	$(NOECHO) $(TOUCH) pm_to_blib
Note the "{{@ARGV}}" on the second line. Remove one set of curly braces so that the line will look like this:

Code: Select all

	$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e "pm_to_blib({@ARGV}, '$(INST_LIB)\auto', q[$(PM_FILTER)], '$(PERM_DIR)')" -- \
Be careful to not remove the TAB character at the beginning of the line.

Go back to around line 248 that looks like this:

Code: Select all

MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e "install([ from_to => {{@ARGV}}, verbose => '$(VERBINST)', uninstall_shadows => '$(UNINST)', dir_mode => '$(PERM_DIR)' ]);" --
and again remove one set of curly braces around @ARGV.

Save the file and go back to the command prompt.

Run "gmake". You should see some output, but no errors, ending with

Code: Select all

C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e cp -- Magick.bs blib\arch\auto\Image\Magick\Magick.bs
C:\strawberry\perl\bin\perl.exe -MExtUtils::Command -e chmod -- 644 blib\arch\auto\Image\Magick\Magick.bs
Run "gmake install". Again you should see some output ending with

Code: Select all

{Appending installation info to C:\strawberry\perl\lib/perllocal.pod}
Make sure PerlMagick is now installed:

Code: Select all

C:\strawberry\cpan\build\PerlMagick-6.77-wFH2IH>perl -MImage::Magick -e 1

C:\strawberry\cpan\build\PerlMagick-6.77-wFH2IH>
Hope this helps somebody!

Alex

carabs
Posts: 2
Joined: 2013-02-27T10:10:05-07:00
Authentication code: 6789

Re: Installing PerlMagick on Windows 7 with Strawberry perl

Post by carabs » 2013-02-27T10:16:29-07:00

Hello,

Thank you for the great information. I recently sitched from using a Ubuntu laptop for dev and an old desktop for photos/design, to using a Windows 7 desktop for both. Since my web apps use Image::Magick for Perl (PerlMagick), I tried installing the mod multiple times. I received your original message each time.

I forllowed your steps, where the code below "Lines 47-50 should look like this:" matched what i had in the file. I ran the make file again and it was saying there were still errors. Narrowing that down I found that paths were just not being found at all.

After an hour of trying to get it to work I realized it is 2am, and I needed to get to bed. I'll try again with this tonight after work, but do you hve any other thoughts on what can be changed? Also, what specific files is it looking for? It looks like some files from the Imagemagick source I extracted. Where should that be located on my system?

Talk to you soon,
Jeff

Post Reply