Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

How to install image::Magick to Strawberry Perl on Windows-10?

by gelbukh (Initiate)
on Aug 31, 2025 at 15:28 UTC ( [id://11166146]=perlquestion: print w/replies, xml ) Need Help??

gelbukh has asked for the wisdom of the Perl Monks concerning the following question:

I've spent months trying to install Image::Magick for my Strawberry on Windows-10: cpan install |Image::magick fails with "Magick.xs:56:10: fatal error: MagickCore/MagickCore.h: No such file or directory"

WhatI've tried: From the official Magick site, I downloaded and ran every .exe "installer". All succeeded until Finish, but they seem to only unpack some files and not to interact with the Perl installation. Perl still fails to use Image::Magick; I also noted that some of the "installers" unpack a .ppd file in their installation directory. But   ppm install Image-Magick.ppd in that directory fails with "but it is not intended for this build of Perl (MSWin32-x64-multi-thread-5.40)".

<code >perl -v </code> says: This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread. Is there an easy way to make  use Image::Magick work on My Strawberry perl? on Windows? If possible step-by-step what specifically to do; from where to download what .

Replies are listed 'Best First'.
Re: How to install image::Magick to Strawberry Perl on Windows-10?
by syphilis (Archbishop) on Sep 03, 2025 at 10:11 UTC
    From https://imagemagick.org/script/download.php#windows, download https://imagemagick.org/archive/binaries/ImageMagick-7.1.2-3-Q16-HDRI-x64-dll.exe.
    Execute the downloaded file (by double-clicking on it) to install ImageMagick.

    I elected (when prompted) to install into C:\d\ImageMagick-7.1.2-Q16-HDRI, rather than into "Program Files".
    (I still avoid installing stuff into a directory whose name so needlessly and pointlessly contains whitespace.)

    In the "Select Additional Tasks" pop-up I additionally selected:
    Install legacy utilities (e.g.identify) Install development headers for C and C++
    The first of those 2 options might not be needed (dunno), but the second is required.
    I did not select the option that would install PerlMagick for Strawberry Perl. (Not brave enough ;-)
    I was a little hesitant to accept the already selected option of "Add application directory to your system path".
    I don't think I did that last time. Instead I would just add the appropriate directory (which would now be "C:\d\ImageMagick-7.1.2-Q16-HDRI") to the PATH, when needed. (I won't have to do that now.)

    That's it for ImageMagick - all set to go once the perl module Image-Magick-7.1.2 has been built and installed.

    Download the Image::Magick source and unpack it into some location, and then cd into the top level folder (ie the one that contains the Makefile.PL).
    For me, having unpacked that source into the D:\w\image-magick folder, I then had to cd into D:\w\image-magick\Image-Magick-7.1.2.

    Next thing is to make a small correction to the Makefile.PL.
    In that file, locate the line "#'CC' => 'gcc -std=gnu99 -std=gnu99'," and change it to"'CC' => 'g++',"

    At this point you can simply run "cpan ." and that should build, test and install Image-Magick-7.1.2 for you.

    Or you can perform the same task in stages, as follows:
    Firstly run "perl Makefile.PL":
    D:\w\image-magick\Image-Magick-7.1.2>perl Makefile.PL Gonna create 'libMagickCore.a' from 'C:\d\ImageMagick-7.1.2-Q16-HDRI\C +ORE_RL_MagickCore_.dll' Checking if your kit is complete... Looks good Warning (mostly harmless): No library found for Generating a gmake-style Makefile Writing Makefile for Image::Magick Writing MYMETA.yml and MYMETA.json
    Then run "gmake":
    D:\w\image-magick\Image-Magick-7.1.2>gmake cp Magick.pm blib\lib\Image\Magick.pm AutoSplitting blib\lib\Image\Magick.pm (blib\lib\auto\Image\Magick) Running Mkbootstrap for Magick () "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Command -e chmod -- 644 "Magick.bs" "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Command::MM -e cp_nonempty -- Magick.bs blib\arch\auto\Ima +ge\Magick\Magick.bs 644 "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" " +C:\perl-5.42.0-1510-ucrt-pos\lib\ExtUtils/xsubpp" -typemap C:\perl-5 +.42.0-1510-ucrt-pos\lib\ExtUtils\typemap -typemap D:\w\image-magick\I +mage-Magick-7.1.2\typemap Magick.xs > Magick.xsc "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Command -e mv -- Magick.xsc Magick.c g++ -c -I"C:\d\ImageMagick-7.1.2-Q16-HDRI\include" -DWIN32 -DWIN64 -f +diagnostics-color=never -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL +_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-stri +ct-aliasing -mms-bitfields -O2 -DVERSION=\"7.1.1\" -DXS_VERSION=\"7 +.1.1\" "-IC:\perl-5.42.0-1510-ucrt-pos\lib\MSWin32-x64-multi-thread\ +CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Mksymlists \ -e "Mksymlists('NAME'=>\"Image::Magick\", 'DLBASE' => 'Magick', ' +DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => +[]);" g++ Magick.def -o blib\arch\auto\Image\Magick\Magick.dll -shared -s -L +"C:\perl-5.42.0-1510-ucrt-pos\lib\MSWin32-x64-multi-thread\CORE" -L"C +:\winpos-ucrt-1510\mingw64\lib" -L"C:\winpos-ucrt-1510\mingw64\x86_64 +-w64-mingw32\lib" -L"C:\winpos-ucrt-1510\mingw64\lib\gcc\x86_64-w64-m +ingw32\15.1.0" -L"D:/w/image-magick/Image-Magick-7.1.2" -L"C:\d\Image +Magick-7.1.2-Q16-HDRI\lib" Magick.o "C:\perl-5.42.0-1510-ucrt-pos\ +lib\MSWin32-x64-multi-thread\CORE\libperl542.a" "libMagickCore.a" "C: +\winpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libmoldname.a" "C:\w +inpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libkernel32.a" "C:\win +pos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libuser32.a" "C:\winpos- +ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libgdi32.a" "C:\winpos-ucrt- +1510\mingw64\x86_64-w64-mingw32\lib\libwinspool.a" "C:\winpos-ucrt-15 +10\mingw64\x86_64-w64-mingw32\lib\libcomdlg32.a" "C:\winpos-ucrt-1510 +\mingw64\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\winpos-ucrt-1510\m +ingw64\x86_64-w64-mingw32\lib\libshell32.a" "C:\winpos-ucrt-1510\ming +w64\x86_64-w64-mingw32\lib\libole32.a" "C:\winpos-ucrt-1510\mingw64\x +86_64-w64-mingw32\lib\liboleaut32.a" "C:\winpos-ucrt-1510\mingw64\x86 +_64-w64-mingw32\lib\libnetapi32.a" "C:\winpos-ucrt-1510\mingw64\x86_6 +4-w64-mingw32\lib\libuuid.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64- +mingw32\lib\libws2_32.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64-ming +w32\lib\libmpr.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib +\libwinmm.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libv +ersion.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libodbc +32.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libodbccp32 +.a" "C:\winpos-ucrt-1510\mingw64\x86_64-w64-mingw32\lib\libcomctl32.a +" -Wl,--enable-auto-image-base "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Command -e chmod -- 755 blib\arch\auto\Image\Magick\Magick +.dll
    Then run "gmake test":
    D:\w\image-magick\Image-Magick-7.1.2>gmake test "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Command::MM -e cp_nonempty -- Magick.bs blib\arch\auto\Ima +ge\Magick\Magick.bs 644 "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" " +-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness +::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t t/blob.t .......... ok t/composite.t ..... ok t/filter.t ........ ok t/getattribute.t .. ok t/montage.t ....... ok t/ping.t .......... ok t/read.t .......... ok t/setattribute.t .. ok t/write.t ......... ok All tests successful. Files=9, Tests=273, 2 wallclock secs ( 0.11 usr + 0.00 sys = 0.11 C +PU) Result: PASS
    Finally, run "gmake install":
    D:\w\image-magick\Image-Magick-7.1.2>gmake install "C:\perl-5.42.0-1510-ucrt-pos\bin\MSWin32-x64-multi-thread\perl.exe" - +MExtUtils::Command::MM -e cp_nonempty -- Magick.bs blib\arch\auto\Ima +ge\Magick\Magick.bs 644 Files found in blib\arch: installing files in blib\lib into architectu +re dependent library tree Installing C:\perl-5.42.0-1510-ucrt-pos\site\lib\MSWin32-x64-multi-thr +ead\auto\Image\Magick\Magick.dll Appending installation info to C:\perl-5.42.0-1510-ucrt-pos\lib\MSWin3 +2-x64-multi-thread/perllocal.pod
    If something goes wrong and you want to redo the build, just run "gmake realclean" and then repeat the procedure, starting with the "perl Makefile.PL" step.

    As you can see - my perl is not actually Strawberry Perl. But I get essentially the same results building with my portable edition of Strawberry Perl-5.40.0.1.
    The only difference I detected is that the Strawberry Perl build emitted the following warning during the "gmake" step:
    cc1plus.exe: warning: command-line option '-std=c99' is valid for C/Ob +jC but not for C++
    I don't like perl being built with the "-std=c99" flag included in $Config{ccflags}, so I build my own perls such that they don't do that.
    Anyway, the warning is apparently benign.

    Cheers,
    Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11166146]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2025-11-13 06:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (68 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.