Search code examples
imagickphp-extensionpeclmagickwand

Imagick pecl installation failed library not found


i'm having issues with imagick installation on my mac run on big sur with pecl installation.

I did install imagemagick using brew with successful but got library not found after running sudo pecl install imagick. Here full error (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/[email protected]/7.4.20/include/php -I/usr/local/Cellar/[email protected]/7.4.20/include/php/main -I/usr/local/Cellar/[email protected]/7.4.20/include/php/TSRM -I/usr/local/Cellar/[email protected]/7.4.20/include/php/Zend -I/usr/local/Cellar/[email protected]/7.4.20/include/php/ext -I/usr/local/Cellar/[email protected]/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/[email protected]/7.4.20/include/php -I/usr/local/Cellar/[email protected]/7.4.20/include/php/main -I/usr/local/Cellar/[email protected]/7.4.20/include/php/TSRM -I/usr/local/Cellar/[email protected]/7.4.20/include/php/Zend -I/usr/local/Cellar/[email protected]/7.4.20/include/php/ext -I/usr/local/Cellar/[email protected]/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/[email protected]/7.4.20/include/php -I/usr/local/Cellar/[email protected]/7.4.20/include/php/main -I/usr/local/Cellar/[email protected]/7.4.20/include/php/TSRM -I/usr/local/Cellar/[email protected]/7.4.20/include/php/Zend -I/usr/local/Cellar/[email protected]/7.4.20/include/php/ext -I/usr/local/Cellar/[email protected]/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

What i observed from the error, the -lgomp arguments expect to receive library location and i suspect the caused of error happens during execution of this line (during linking mode):

/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/[email protected]/7.4.20/include/php -I/usr/local/Cellar/[email protected]/7.4.20/include/php/main -I/usr/local/Cellar/[email protected]/7.4.20/include/php/TSRM -I/usr/local/Cellar/[email protected]/7.4.20/include/php/Zend -I/usr/local/Cellar/[email protected]/7.4.20/include/php/ext -I/usr/local/Cellar/[email protected]/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

Found out there are two -lgomp been used for above command:

  1. -lgomp -Wl and
  2. -lgomp -L/usr/local/Cellar/imagemagick/7.1.0-0/lib......

and here i am, stuck with it, had no idea which library not found.

Pecl Version

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-config location

/usr/local/bin/MagickWand-config

imagemagick version

imagemagick 7.1.0-0

imagick version

imagick-3.5.0

Solution

  • [SOLVED]

    Seems like imagemagick version 7.1.0-0 is not properly working with imagick version 3.5.0(stable and latest release at the time of writing).

    Had to build from source(https://github.com/Imagick/imagick) with tag version3.4.4. Didn't found in any docs for compatibility between these two version.

    Hopefully can helps someone out there as well :)