When I try to run the following command
pecl install imagick
Then the installation end up with:
imagemagick/7.0.11-9/lib -L/usr/local/Cellar/imagemagick/7.0.11-9/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.0.11-9/lib /usr/local/Cellar/imagemagick/7.0.11-9/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.1/lib -L/usr/local/opt/gettext/lib /usr/local/Cellar/imagemagick/7.0.11-9/lib/libMagickCore-7.Q16HDRI.dylib -Wl,-rpath -Wl,/usr/local/Cellar/imagemagick/7.0.11-9/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
The reason seems to be that the compilation of the last version of imagick (3.5.0) has changes that require this library. It’s impossible to install a lower version because they are not compatible with PHP 8.0.
Any idea how to get rid of this error on macos?
3
Answers
A new version has been tag and contains the build configuration fixed! You can install it with this command:
(without the version it should now work)
Update 22 July 2021
As of 22 July 2021, version 3.5.1 is stable in the
pecl
channel and can be used to compile imagick for both PHP 7 and PHP 8.The general command will not fail anymore
Old Answer
Version 3.5 currently can’t compile on MAC because of missing/broken support for
gomp
of the MACgcc
compiler.Best fix is to install version 3.4.4
More info here
There is a fix for this issue by manually installing the extension. The only issue with it is that it does not appear in the pecl installed extensions after the installation is done and can’t be uninstalled from pecl. Nonetheless I’m providing the answer I found here:
Run the following commands
To explain the previous process command line by command line:
config.m4
file for safety purposesconfig.m4
file to fixgomp
issue as explained hereAnd finally simply continue with the manual installation process
After this, you should be good to go to use the latest
imagick
extension for PHP. ForPHP 8.0
andimagick 3.5.0
theso
file is located at/usr/local/lib/php/pecl/20200930/imagick.so