Installing PerlMagick on Windows 7 with Strawberry perl
Posted: 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:
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:
Lines 47-50 should look like this:
Save the file and run "perl Makefile.PL". You should see something like this:
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:
Note the "{{@ARGV}}" on the second line. Remove one set of curly braces so that the line will look like this:
Be careful to not remove the TAB character at the beginning of the line.
Go back to around line 248 that looks like this:
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
Run "gmake install". Again you should see some output ending with
Make sure PerlMagick is now installed:
Hope this helps somebody!
Alex
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.
...
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');
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');
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
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
Code: Select all
$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e "pm_to_blib({@ARGV}, '$(INST_LIB)\auto', q[$(PM_FILTER)], '$(PERM_DIR)')" -- \
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)' ]);" --
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
Code: Select all
{Appending installation info to C:\strawberry\perl\lib/perllocal.pod}
Code: Select all
C:\strawberry\cpan\build\PerlMagick-6.77-wFH2IH>perl -MImage::Magick -e 1
C:\strawberry\cpan\build\PerlMagick-6.77-wFH2IH>
Alex