我在mac-run上安装imagick时遇到问题,使用pecl安装。
我确实使用brew成功安装了imagemagick,但在运行sudo pecl install imagick
后得到了library not found
。此处为完全错误(https://pastebin.com/SULyu9Rx):
....
.....
.....
^~~~~~~~
2 warnings generated.
/bin/sh /private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/libtool --mode=compile cc -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.1.0-0/include/ImageMagick-7 -I. -I/private/tmp/pear/temp/imagick -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/include -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/main -I/private/tmp/pear/temp/imagick -I/usr/local/Cellar/php@7.4/7.4.20/include/php -I/usr/local/Cellar/php@7.4/7.4.20/include/php/main -I/usr/local/Cellar/php@7.4/7.4.20/include/php/TSRM -I/usr/local/Cellar/php@7.4/7.4.20/include/php/Zend -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext/date/lib -I/usr/local/Cellar/imagemagick/7.1.0-0/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/imagick/shim_im6_to_im7.c -o shim_im6_to_im7.lo
cc -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.1.0-0/include/ImageMagick-7 -I. -I/private/tmp/pear/temp/imagick -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/include -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/main -I/private/tmp/pear/temp/imagick -I/usr/local/Cellar/php@7.4/7.4.20/include/php -I/usr/local/Cellar/php@7.4/7.4.20/include/php/main -I/usr/local/Cellar/php@7.4/7.4.20/include/php/TSRM -I/usr/local/Cellar/php@7.4/7.4.20/include/php/Zend -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext/date/lib -I/usr/local/Cellar/imagemagick/7.1.0-0/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/imagick/shim_im6_to_im7.c -fno-common -DPIC -o .libs/shim_im6_to_im7.o
/bin/sh /private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/libtool --mode=link cc -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/include -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/main -I/private/tmp/pear/temp/imagick -I/usr/local/Cellar/php@7.4/7.4.20/include/php -I/usr/local/Cellar/php@7.4/7.4.20/include/php/main -I/usr/local/Cellar/php@7.4/7.4.20/include/php/TSRM -I/usr/local/Cellar/php@7.4/7.4.20/include/php/Zend -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext/date/lib -I/usr/local/Cellar/imagemagick/7.1.0-0/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -o imagick.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/modules imagick_file.lo imagick_class.lo imagickdraw_class.lo imagickpixel_class.lo imagickpixeliterator_class.lo imagick_helpers.lo imagick.lo imagickkernel_class.lo shim_im6_to_im7.lo -lgomp -Wl,-rpath,/usr/local
/Cellar/imagemagick/7.1.0-0/lib -L/usr/local/Cellar/imagemagick/7.1.0-0/lib -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/imagick.so -bundle .libs/imagick_file.o .libs/imagick_class.o .libs/imagickdraw_class.o .libs/imagickpixel_class.o .libs/imagickpixeliterator_class.o .libs/imagick_helpers.o .libs/imagick.o .libs/imagickkernel_class.o .libs/shim_im6_to_im7.o -lgomp -L/usr/local/Cellar/imagemagick/7.1.0-0/lib /usr/local/Cellar/imagemagick/7.1.0-0/lib/libMagickWand-7.Q16HDRI.dylib -L/usr/local/Cellar/little-cms2/2.12/lib -L/usr/local/opt/freetype/lib -L/usr/local/Cellar/glib/2.68.3/lib -L/usr/local/opt/gettext/lib -L/usr/local/Cellar/fontconfig/2.13.1/lib /usr/local/Cellar/imagemagick/7.1.0-0/lib/libMagickCore-7.Q16HDRI.dylib -Wl,-rpath -Wl,/usr/local/Cellar/imagemagick/7.1.0-0/lib
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [imagick.la] Error 1
ERROR: `make' failed
我从错误中观察到,-lgomp
参数期望接收库位置,我怀疑错误的原因发生在执行此行期间(在链接模式期间(:
/bin/sh /private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/libtool --mode=link cc -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/include -I/private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/main -I/private/tmp/pear/temp/imagick -I/usr/local/Cellar/php@7.4/7.4.20/include/php -I/usr/local/Cellar/php@7.4/7.4.20/include/php/main -I/usr/local/Cellar/php@7.4/7.4.20/include/php/TSRM -I/usr/local/Cellar/php@7.4/7.4.20/include/php/Zend -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext -I/usr/local/Cellar/php@7.4/7.4.20/include/php/ext/date/lib -I/usr/local/Cellar/imagemagick/7.1.0-0/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -o imagick.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/pear/temp/pear-build-rootpIumPp/imagick-3.5.0/modules imagick_file.lo imagick_class.lo imagickdraw_class.lo imagickpixel_class.lo imagickpixeliterator_class.lo imagick_helpers.lo imagick.lo imagickkernel_class.lo shim_im6_to_im7.lo -lgomp -Wl,-rpath,/usr/local
/Cellar/imagemagick/7.1.0-0/lib -L/usr/local/Cellar/imagemagick/7.1.0-0/lib -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/imagick.so -bundle .libs/imagick_file.o .libs/imagick_class.o .libs/imagickdraw_class.o .libs/imagickpixel_class.o .libs/imagickpixeliterator_class.o .libs/imagick_helpers.o .libs/imagick.o .libs/imagickkernel_class.o .libs/shim_im6_to_im7.o -lgomp -L/usr/local/Cellar/imagemagick/7.1.0-0/lib /usr/local/Cellar/imagemagick/7.1.0-0/lib/libMagickWand-7.Q16HDRI.dylib -L/usr/local/Cellar/little-cms2/2.12/lib -L/usr/local/opt/freetype/lib -L/usr/local/Cellar/glib/2.68.3/lib -L/usr/local/opt/gettext/lib -L/usr/local/Cellar/fontconfig/2.13.1/lib /usr/local/Cellar/imagemagick/7.1.0-0/lib/libMagickCore-7.Q16HDRI.dylib -Wl,-rpath -Wl,/usr/local/Cellar/imagemagick/7.1.0-0/lib
发现有两个-lgomp
被用于上述命令:
-lgomp -Wl
和-lgomp -L/usr/local/Cellar/imagemagick/7.1.0-0/lib......
而我就在这里,一直坚持着,不知道找不到哪个库。
Pecl版本
PEAR Version: 1.10.12
PHP Version: 7.4.20
Zend Engine Version: 3.4.0
Running on: Darwin users-MacBook-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
MagickWand配置位置
/usr/local/bin/MagickWand-config
imagemagick版本
imagemagick 7.1.0-0
imagick版本
imagick-3.5.0
[已解决]
imagemagick
版本7.1.0-0似乎无法正确使用imagick
版本3.5.0(在撰写本文时是稳定的最新版本(。
必须从源代码构建(https://github.com/Imagick/imagick)标签版本为CCD_ 9。没有在任何文档中找到这两个版本之间的兼容性。
希望也能帮助其他人:(