简体   繁体   中英

Errors trying to install perl Image::Magick module on macOS, ventura, 13.2 (Intel machine)

I have imagemagick installed with brew as well as opencl-headers. Trying to install perl's Image::Magick module running on Perl 5.36, I get the following errors running cpanm Image::Magick :

Writing MYMETA.yml and MYMETA.json
OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.64)
Checking if you have parent 0 ... Yes (0.238)
Building and testing Image-Magick-v7.0.11 ... cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Magick ()
chmod 644 "Magick.bs"
"/Users/steve/perl5/perlbrew/perls/perl-5.36.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
"/Users/steve/perl5/perlbrew/perls/perl-5.36.0/bin/perl" "/Users/steve/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0/ExtUtils/xsubpp"  -typemap '/Users/steve/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0/ExtUtils/typemap' -typemap '/Users/steve/.cpanm/work/1675177488.60361/Image-Magick-7.0.11/typemap'  Magick.xs > Magick.xsc
mv Magick.xsc Magick.c
cc -c  -I/usr/local/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-7" -fno-common -DPERL_DARWIN -mmacosx-version-min=12.5 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Wno-error=implicit-function-declaration -O3   -DVERSION=\"7.0.11\" -DXS_VERSION=\"7.0.11\"  "-I/Users/steve/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0/darwin-2level/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
rm -f blib/arch/auto/Image/Magick/Magick.bundle
LD_RUN_PATH="/usr/local/lib:/usr/lib" cc -Wl,-rpath,"/usr/local/lib:/usr/lib" -L/usr/local/lib -lMagickCore-7.Q16HDRI  -mmacosx-version-min=12.5 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong   Magick.o  -o blib/arch/auto/Image/Magick/Magick.bundle  \
           -L/usr/local/lib -lMagickCore-7.Q16HDRI -lm -L/Users/steve/perl5/perlbrew/perls/perl-5.36.0/lib/5.36.0/darwin-2level/CORE   \

ld: warning: -undefined dynamic_lookup may not work with chained fixups
ld: warning: dylib (/usr/local/lib/libMagickCore-7.Q16HDRI.dylib) was built for newer macOS version (13.0) than being linked (12.5)
chmod 755 blib/arch/auto/Image/Magick/Magick.bundle
Manifying 1 pod document
"/Users/steve/perl5/perlbrew/perls/perl-5.36.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
PERL_DL_NONLAZY=1 "/Users/steve/perl5/perlbrew/perls/perl-5.36.0/bin/perl" "-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 ......... Failed 1/32 subtests

Test Summary Report
-------------------
t/write.t       (Wstat: 0 Tests: 32 Failed: 1)
  Failed test:  24
Files=9, Tests=273,  2 wallclock secs ( 0.06 usr  0.02 sys +  4.10 cusr  0.56 csys =  4.74 CPU)
Result: FAIL
Failed 1/9 test programs. 1/273 subtests failed.
make: *** [test_dynamic] Error 255
FAIL

Also seem to be having issues

Based on the name of the test that was failing:

t/write.t......... Failed 1/32 subtests

It seems like the problem was likely some kind of permission issue. So I did "cpanm --force Image::Magick". After installing, my Perl script which uses ImageMagick works fine.

Without wishing in the slightest to disparage the work of any of the good folk who port and maintain packages for us, I note the following:

  • there are just 37 questions tagged on StackOverflow , versus 9,000+ on ImageMagick - so your chances of support/assistance are distinctly lower with Perl

  • Apple has stated its intention to discontinue Perl , PHP and other interpreters in the next macOS version and it is getting more difficult with each macOS release to use ImageMagick with PHP and Perl .


Given the above, I would personally think twice about investing a large amount of effort into PerlMagick on macOS - especially when you consider that it is very simple to use docker and if you go that way, you can run your docker image on any macOS or Linux machine without worrying about the vagaries of the distribution. So, here is a very simple way to run PerlMagick in docker :

docker run -it alpine                                  # 2 seconds later
apk update && apk add perl imagemagick-perlmagick      # 8 seconds later

# All ready to run PerlMagick - let's test a simple example
perl -MImage::Magick -le 'print Image::Magick->QuantumDepth'
16

Of course, you can put the two apk package management commands into a Dockerfile so they are built-in and don't need running each time.

You can also dynamically bind-mount any macOS directory full of images to process into the docker image so that it can read/write them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM