http://www.perlmonks.org?node_id=11157705


in reply to Re^2: Errors While Installing Image::Magick
in thread Errors While Installing Image::Magick

Your problem seems to be associated with the need for a C++ compiler.
I don't hit that problem ... but then I'm on a modern perl, using (a modern) gcc-13.1.0.
But I wonder if there's a compiler switch (maybe -std=c++11) that would fix that for you.
I'm pretty sure you can modify $Config{{ccflags} by hand-editing the "ccflags" entries in lib/Config.pm and lib/Config_heavy.pl, if you want to give that a try.

Below is what I just got (minus some compilation warnings).
Not sure why one test failed ... that doesn't normally happen, AFAIK.

Cheers,
Rob
Configuring J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz with Makefile.PL Gonna create 'libMagickCore.a' from 'C:\d\ImageMagick-7.1.1-Q16-HDRI\C +ORE_RL_MagickCore_.dll' Checking if your kit is complete... Looks good Generating a gmake-style Makefile Writing Makefile for Image::Magick Writing MYMETA.yml and MYMETA.json JCRISTY/Image-Magick-7.1.1-28.tar.gz D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.ex +e Makefile.PL -- OK Running make for J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz cp Magick.pm blib\lib\Image\Magick.pm AutoSplitting blib\lib\Image\Magick.pm (blib\lib\auto\Image\Magick) Running Mkbootstrap for Magick () "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" -MExtUtils::Command -e chmod -- 644 "Magick.bs" "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" -MExtUtils::Command::MM -e cp_nonempty -- Magick.bs blib\arch\auto\ +Image\Magick\Magick.bs 644 "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" "D:\perl-5.39.7-1320-ucrt-mcf\lib\ExtUtils/xsubpp" -typemap D:\per +l-5.39.7-1320-ucrt-mcf\lib\ExtUtils\typemap -typemap C:\Users\Owner\. +cpan\build\Image-Magick-7.1.1-16\typemap Magick.xs > Magick.xsc "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" -MExtUtils::Command -e mv -- Magick.xsc Magick.c gcc -c -I"C:\d\ImageMagick-7.1.1-Q16-HDRI\include" -Wall -Wextra -Wer +ror=pointer-arith -Wno-format -Wno-long-long -Werror=vla -std=c99 -DW +IN32 -DWIN64 -fdiagnostics-color=never -DPERL_TEXTMODE_SCRIPTS -DMULT +IPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -f +wrapv -fno-strict-aliasing -mms-bitfields -Os -DVERSION=\"7.1.1\" - +DXS_VERSION=\"7.1.1\" "-ID:\perl-5.39.7-1320-ucrt-mcf\lib\MSWin32-x6 +4-multi-thread-ld\CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c [ snipped some compilation warnings for brevity ] "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\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 +"D:\perl-5.39.7-1320-ucrt-mcf\lib\MSWin32-x64-multi-thread-ld\CORE" - +L"C:\winlibs-ucrt-1320\mingw64\lib" -L"C:\winlibs-ucrt-1320\mingw64\x +86_64-w64-mingw32\lib" -L"C:\winlibs-ucrt-1320\mingw64\lib\gcc\x86_64 +-w64-mingw32\13.2.0" -L"C:/Users/Owner/.cpan/build/Image-Magick-7.1.1 +-16" -L"C:\d\ImageMagick-7.1.1-Q16-HDRI\lib" Magick.o "D:\perl-5.3 +9.7-1320-ucrt-mcf\lib\MSWin32-x64-multi-thread-ld\CORE\libperl539.a" +"libMagickCore.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\li +b\libmoldname.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib +\libkernel32.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\ +libuser32.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\lib +gdi32.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libwins +pool.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libcomdl +g32.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libadvapi +32.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libshell32 +.a" "C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libole32.a" +"C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\liboleaut32.a" " +C:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libnetapi32.a" "C +:\winlibs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libuuid.a" "C:\win +libs-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libws2_32.a" "C:\winlib +s-ucrt-1320\mingw64\x86_64-w64-mingw32\lib\libmpr.a" "C:\winlibs-ucrt +-1320\mingw64\x86_64-w64-mingw32\lib\libwinmm.a" "C:\winlibs-ucrt-132 +0\mingw64\x86_64-w64-mingw32\lib\libversion.a" "C:\winlibs-ucrt-1320\ +mingw64\x86_64-w64-mingw32\lib\libodbc32.a" "C:\winlibs-ucrt-1320\min +gw64\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\winlibs-ucrt-1320\ming +w64\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-image-bas +e "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" -MExtUtils::Command -e chmod -- 755 blib\arch\auto\Image\Magick\Mag +ick.dll JCRISTY/Image-Magick-7.1.1-28.tar.gz C:\make\bin\make.EXE -- OK The current configuration of allow_installing_outdated_dists is 'ask/n +o', but for this option we would need 'CPAN::DistnameInfo' installed. + Please install 'CPAN::DistnameInfo' as soon as possible. As long as +we are not equipped with 'CPAN::DistnameInfo' this option does not ta +ke effect Running make test for JCRISTY/Image-Magick-7.1.1-28.tar.gz "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" -MExtUtils::Command::MM -e cp_nonempty -- Magick.bs blib\arch\auto\ +Image\Magick\Magick.bs 644 "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harn +ess::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t t/blob.t .......... ok t/composite.t ..... ok t/filter.t ........ Failed 1/58 subtests t/getattribute.t .. ok t/montage.t ....... ok t/ping.t .......... ok t/read.t .......... ok t/setattribute.t .. ok t/write.t ......... ok Test Summary Report ------------------- t/filter.t (Wstat: 0 Tests: 58 Failed: 1) Failed test: 2 Files=9, Tests=273, 2 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 C +PU) Result: FAIL Failed 1/9 test programs. 1/273 subtests failed. make.EXE: *** [makefile:1047: test_dynamic] Error 255 JCRISTY/Image-Magick-7.1.1-28.tar.gz C:\make\bin\make.EXE test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports JCRISTY/Image-Magick-7.1.1-28.tar.gz Running make install for JCRISTY/Image-Magick-7.1.1-28.tar.gz "D:\perl-5.39.7-1320-ucrt-mcf\bin\MSWin32-x64-multi-thread-ld\perl.exe +" -MExtUtils::Command::MM -e cp_nonempty -- Magick.bs blib\arch\auto\ +Image\Magick\Magick.bs 644 Files found in blib\arch: installing files in blib\lib into architectu +re dependent library tree Installing D:\perl-5.39.7-1320-ucrt-mcf\site\lib\MSWin32-x64-multi-thr +ead-ld\auto\Image\Magick\Magick.dll Appending installation info to D:\perl-5.39.7-1320-ucrt-mcf\lib\MSWin3 +2-x64-multi-thread-ld/perllocal.pod JCRISTY/Image-Magick-7.1.1-28.tar.gz C:\make\bin\make.EXE install -- OK

Replies are listed 'Best First'.
Re^4: Errors While Installing Image::Magick
by syphilis (Archbishop) on Feb 15, 2024 at 11:29 UTC
    But I wonder if there's a compiler switch (maybe -std=c++11) that would fix that for you.

    Not that I can find.
    Having upgraded the ImageMagick executable from release 19 to release 28, I hit the same issue.
    To fix, I did a cd to the .cpan build directory and started by removing the failed cpan -fi Image::Magick attempt:
    C:\> cd \Users\Owner\.cpan\build\Image-Magick-7.1.1-18 then C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>gmake realclean then C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>perl Makefile.PL CC=g +++ then C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>gmake test then C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>gmake install
    That worked fine for me, though the single test still failed:
    t/blob.t .......... ok t/composite.t ..... ok t/filter.t ........ Failed 1/58 subtests t/getattribute.t .. ok t/montage.t ....... ok t/ping.t .......... ok t/read.t .......... ok t/setattribute.t .. ok t/write.t ......... ok Test Summary Report ------------------- t/filter.t (Wstat: 0 Tests: 58 Failed: 1) Failed test: 2 Files=9, Tests=273, 1 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 C +PU) Result: FAIL Failed 1/9 test programs. 1/273 subtests failed. gmake: *** [makefile:1048: test_dynamic] Error 255
    Update: Looks like that one test fails for me because the font "Generic.ttf" can't be found:
    Annotate(text=>'Magick',geometry=>'+0+20',font=>'Generic.ttf',fill=>'g +old',gravity=>'North',pointsize=>14) ... Annotate (text=>'Magick',geometry=>'+0+20',font=>'Generic.ttf',fill= +>'gold',gravity=>'North',pointsize=>14): Exception 305: unable to read font `Generic.ttf' @ warning/annotate. +c/RenderType/1024 not ok 2
    Update 2: In the previous versions of Image::Magick that I've built, "Generic.tiff" has been provided in both the "demo" and the "t" folders - though the MANIFEST file listed only "demo/Generic.tiff"..
    Now, however, "Generic.tiff" is to be found only in the "demo" folder.
    Copying "demo/Generic.tiff" to "t/Generic.tiff" allows all tests to pass.

    Cheers,
    Rob
      Thanks for the helpful suggestions syphilis. Here is a summary of the latest things I have tried, per your suggestions. I still haven't been able isolate the source of "ccflags".

      I'm closer, thanks to you, but still no cigar. :-)

      Update: I believe the basic question comes down to whether the gcc compiler in Strawberry Perl 5.24.1 is capable of compiling the code for Image::Magick, and if not, is there a viable alternative that does not involve upgrading to a more recent version of Perl? For now, I must remain at 5.24.1 for a number of reasons.


      I did the "Clean and rerun install" -- got the following errors with gmake test:
      ---------------------------------------------------------------------------------------------
      cd \Users\Owner\.cpan\build\Image-Magick-7.1.1-18
      C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>gmake realclean
      C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>perl Makefile.PL CC=g++
      C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>gmake test
      C:\Users\Owner\.cpan\build\Image-Magick-7.1.1-18>gmake install

      C:\Strawberry\cpan\build\Image-Magick-7.1.1-10> gmake test {Running Mkbootstrap for Magick ()} "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 +"Magick.bs" "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonemp +ty -- Magick.bs blib\arch\auto\Image\Magick\Magick.bs 644 "C:\Strawberry\perl\bin\perl.exe" "C:\Strawberry\perl\lib\ExtUtils\\xs +ubpp" -typemap C:\strawberry\perl\lib\ExtUtils\typemap -typemap C:\S +trawberry\cpan\build\Image-Magick-7.1.1-10\typemap Magick.xs > Magic +k.xsc "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- Magick. +xsc Magick.c g++ -c -I"C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\include" -s -O2 + -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLI +CIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bit +fields -s -O2 -DVERSION=\"7.1.1\" -DXS_VERSION=\"7.1.1\" "-IC:\strawberry\perl\lib\CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magi +ck.c In file included from C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\incl +ude/MagickCore/stream.h:25:0, from C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\incl +ude/MagickCore/blob.h:49, from C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\incl +ude/MagickCore/image.h:111, from C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\incl +ude/MagickCore/draw.h:22, from C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\incl +ude/MagickCore/annotate.h:21, from C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\incl +ude/MagickCore/MagickCore.h:80, from Magick.xs:56: C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\include/MagickCore/pixel.h +:34:16: warning: scoped enums only available with -std=c++11 or -std= +gnu++11 typedef enum : MagickOffsetType ^ "C:\Strawberry\perl\bin\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.xs.dll -mdll -s - +L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib" -L"C:/Strawber +ry/cpan/build/Image-Magick-7.1.1-10" -L"C:\Program Files\ImageMagick- +7.1.1-Q16-HDRI\lib" Magick.o "C:\strawberry\perl\lib\CORE \libperl524.a" "libMagickCore.a" "C:\strawberry\c\x86_64-w64-mingw32\l +ib\libmoldname.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libkernel32 +.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libuser32.a" "C:\strawber +ry\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\strawberry\c\x86 _64-w64-mingw32\lib\libwinspool.a" "C:\strawberry\c\x86_64-w64-mingw32 +\lib\libcomdlg32.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libadvapi +32.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\straw +berry\c\x86_64-w64-mingw32\lib\libole32.a" "C:\strawberry\c\ x86_64-w64-mingw32\lib\liboleaut32.a" "C:\strawberry\c\x86_64-w64-ming +w32\lib\libnetapi32.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libuui +d.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\strawbe +rry\c\x86_64-w64-mingw32\lib\libmpr.a" "C:\strawberry\c\x86_ 64-w64-mingw32\lib\libwinmm.a" "C:\strawberry\c\x86_64-w64-mingw32\lib +\libversion.a" "C:\strawberry\c\x86_64-w64-mingw32\lib\libodbc32.a" " +C:\strawberry\c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\strawberry\ +c\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-im age-base "C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 755 +blib\arch\auto\Image\Magick\Magick.xs.dll fileparse(): need a valid pathname at C:/Strawberry/perl/site/lib/ExtU +tils/Install.pm line 1187. makefile:1067: recipe for target 'pm_to_blib' failed gmake: *** [pm_to_blib] Error 255 C:\Strawberry\cpan\build\Image-Magick-7.1.1-10> gmake install fileparse(): need a valid pathname at C:/Strawberry/perl/site/lib/ExtU +tils/Install.pm line 1187. makefile:1067: recipe for target 'pm_to_blib' failed gmake: *** [pm_to_blib] Error 255


      I tried editing the following files and found this:
      ----------------------------------------------------------
      C:\Strawberry\perl\lib\Config.pm -- No "ccflags" entries in this file.
      C:\Strawberry\perl\lib\Config_heavy.pl -- I found: cc='$cc', ccflags ='$ccflags', but $ccflags is set somewhere else (this is the only reference).


      I ran the following to display the contents of $Config{ccflags}:
      ----------------------------------------------------------------------------
      perl -MConfig -e "print $Config{ccflags}
      -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields


      I fixed the missing "Generic.tiff" file:
      ---------------------------------------------
      cd C:\Strawberry\cpan\build\Image-Magick-7.1.1-10
      copy demo\Generic.ttf t\

      "It's not how hard you work, it's how much you get done."

        fileparse(): need a valid pathname at C:/Strawberry/perl/site/lib/ExtUtils/Install.pm line 1187.

        I've installed SP-5.24.1.1 - same version as yours, but I can't reproduce the problem.
        I've grabbed the "portable" version, not the "msi installer" - but that should make no difference.
        I do see the "scoped enums only available with -std=c++11 or -std=gnu++11" warning, but the build succeeds anyway.

        So I think we're looking at a problem with ExtUtils::MakeMaker.
        What version of ExtUtils::MakeMaker do you have ?
        Strawberry 5.24.1 shipped with version 7.24, and that's the version I've used.
        On Strawberry 5.24.4 (which I already had), version 7.34 is installed - and there was no problem with it, either.

        Also, what does line 1187 of Install.pm state ? (We might be able to fix your issue by patching that file.)

        Update:
        C:\Strawberry\perl\lib\Config.pm -- No "ccflags" entries in this file.
        C:\Strawberry\perl\lib\Config_heavy.pl -- I found: cc='$cc', ccflags ='$ccflags', but $ccflags is set somewhere else (this is the only reference).


        Sorry - skimmed past that.
        Yes - wrt altering of $Config{ccflags}, it's only Config_heavy.pl that needs patching.
        If you keep searching further through that file you'll come to the line that needs to be altered. Search for ccflags=
        I think you can also temporarily override ccflags the same way as I did for cc:
        perl Makefile.PL CC=g++ CCFLAGS="full space-delimited list of all the +flags that you want"
        Cheers,
        Rob