Reputation: 1139
I am using Strawbery Perl and trying to apply the image::Magick package on Windows 11 OS but keep getting errors:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>cpanm --force Image::Magick --> Working on Image::Magick Fetching http://www.cpan.org/authors/id/J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz ... OK Configuring Image-Magick-v7.1.1 ... OK Building and testing Image-Magick-v7.1.1 ... FAIL ! Installing Image::Magick failed. See C:\Users\miki.cpanm\work\1725780811.5804\build.log for details. Retry with --force to force install it.
Log file of "C:\Users\miki.cpanm\work\1725780811.5804\build.log":
cpanm (App::cpanminus) 1.7047 on perl 5.040000 built for MSWin32-x64-multi-thread
Work directory is C:\Users\miki/.cpanm/work/1725780811.5804
You have make C:\Strawberry\c\bin\gmake.exe
You have LWP 6.77
Falling back to Archive::Tar 3.02_001
Searching Image::Magick () on cpanmetadb ...
--> Working on Image::Magick
Fetching http://www.cpan.org/authors/id/J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz
-> OK
Unpacking Image-Magick-7.1.1-28.tar.gz
Entering Image-Magick-7.1.1
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.70)
Configuring Image-Magick-v7.1.1
Running Makefile.PL
Gonna create 'libMagickCore.a' from 'C:\Program Files\ImageMagick-7.1.1-Q16\CORE_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
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have parent 0 ... Yes (0.241)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.70)
Building and testing Image-Magick-v7.1.1
cp Magick.pm blib\lib\Image\Magick.pm
AutoSplitting blib\lib\Image\Magick.pm (blib\lib\auto\Image\Magick)
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_nonempty -- Magick.bs blib\arch\auto\Image\Magick\Magick.bs 644
"C:\Strawberry\perl\bin\perl.exe" "C:\Strawberry\perl\lib\ExtUtils/xsubpp" -typemap C:\STRAWB~1\perl\lib\ExtUtils\typemap -typemap C:\Users\miki\.cpanm\work\1725780811.5804\Image-Magick-7.1.1\typemap Magick.xs > Magick.xsc
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- Magick.xsc Magick.c
gcc -c -I"C:\Program Files\ImageMagick-7.1.1-Q16\include" -std=c99 -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -Os -falign-functions -falign-jumps -falign-labels -falign-loops -freorder-blocks -freorder-blocks-algorithm=stc -freorder-blocks-and-partition -DVERSION=\"7.1.1\" -DXS_VERSION=\"7.1.1\" "-IC:\STRAWB~1\perl\lib\CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
In file included from C:\Program Files\ImageMagick-7.1.1-Q16\include/MagickCore/magick-config.h:25,
from C:\Program Files\ImageMagick-7.1.1-Q16\include/MagickCore/MagickCore.h:29,
from Magick.xs:56:
C:\Program Files\ImageMagick-7.1.1-Q16\include/MagickCore/magick-baseconfig.h:274:6: error: #error ImageMagick was build with a 64 channel bit mask and that requires a C++ compiler
274 | # error ImageMagick was build with a 64 channel bit mask and that requires a C++ compiler
| ^~~~~
gmake: *** [makefile:350: Magick.o] Error 1
-> FAIL Installing Image::Magick failed. See C:\Users\miki\.cpanm\work\1725780811.5804\build.log for details. Retry with --force to force install it.
Seems that both Perl and image Magick version are 64-bit:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>perl -v This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread*
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>perl -v This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread
I tried to install several versions of ImageMagick (e.g. ImageMagick-7.1.1-Q16) And checked all options:
Added C:\Program Files\ImageMagick-7.1.1-Q16
to PATH.
I also installed Visual studio Build tools 2022 and retry to install from cpan via developer command prompt (also as administrator).
Running cl
seems to work fine:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>cl Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34120 for x86 Copyright (C) Microsoft Corporation. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ]
Running magick --version
seems to work fine:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>magick --version Version: ImageMagick 7.1.1-38 Q16 x64 b0ab922:20240901 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Channel-masks(64-bit) Cipher DPC Modules OpenCL OpenMP(2.0) Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg jxl lcms lqr lzma openexr pangocairo png ps raqm raw rsvg tiff webp xml zip zlib Compiler: Visual Studio 2022 (194134120)
Any idea what else I can try here?
Thanks! Miki
Upvotes: 2
Views: 133
Reputation: 1139
I assume that although running the cpan installation from Developer command prompt (C++ compiler) 64 bit, it use some other default c++ compiler which is 32 bit. I re-installed Strawberry and ImageMagick in 32 bit and it solved the problem.
Thanks!
Upvotes: 4