简体   繁体   English

尝试在 macOS、ventura、13.2(Intel 机器)上安装 perl Image::Magick 模块时出错

[英]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.我安装了 imagemagick 和 brew 以及 opencl-headers。 Trying to install perl's Image::Magick module running on Perl 5.36, I get the following errors running cpanm Image::Magick :尝试安装在 Perl 5.36 上运行的 perl Image::Magick 模块,我在运行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".所以我做了“cpanm --force Image::Magick”。 After installing, my Perl script which uses ImageMagick works fine.安装后,我的 Perl 使用 ImageMagick 的脚本工作正常。

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 PerlStackOverflow上只有 37 个问题被标记为 ,而在ImageMagick上有 9,000 多个问题 - 所以您在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 . Apple 已表示打算在下一个macOS版本中停止使用PerlPHP和其他解释器,并且随着每个macOS版本的发布,使用ImageMagickPHPPerl变得越来越困难。


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.鉴于上述情况,我个人会三思而后行,在macOS上对PerlMagick投入大量精力 - 特别是当您认为使用docker非常简单并且如果您以这种方式使用go时,您可以在任何 macOS 或Linux机器不用担心变幻莫测的配置。 So, here is a very simple way to run PerlMagick in docker :因此,这是在docker中运行PerlMagick的一种非常简单的方法:

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.当然,你可以把package这两个apk管理命令放到一个Dockerfile里面,这样就内置了,不用每次都运行。

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.您还可以动态绑定挂载任何充满图像的macOS目录以处理到 docker 图像中,以便它可以读取/写入它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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