Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to install Imagick in PHP 8 #331

Closed
schuer opened this issue Jul 7, 2020 · 26 comments
Closed

Not able to install Imagick in PHP 8 #331

schuer opened this issue Jul 7, 2020 · 26 comments

Comments

@schuer
Copy link

schuer commented Jul 7, 2020

When trying to install Imagick (3.4.4) within the new PHP 8 (alpha) Docker images (all Apache, FPM and Alpine), it thows errors like:

In file included from /usr/src/php/ext/imagick/imagick_file.c:22:
/usr/src/php/ext/imagick/php_imagick_file.h:61:108: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   61 | zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
      |                                                                                                            ^~~~~~~~~	

Error log:

+ docker-php-ext-install imagick
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/1) Installing .phpize-deps (20200628.155720)
OK: 364 MiB in 105 packages
Configuring for:
PHP Api Version:         20190128
Zend Module Api No:      20190128
Zend Extension Api No:   420190128
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20190128
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable the imagick extension... yes, shared
checking for pkg-config... /usr/bin/pkg-config
checking ImageMagick MagickWand API configuration program... checking Testing /usr/local/bin/MagickWand-config... Doesn't exist
checking Testing /usr/bin/MagickWand-config... It exists
found in /usr/bin/MagickWand-config
checking if ImageMagick version is at least 6.2.4... found version 7.0.10 Q16 HDRI
checking for MagickWand.h or magick-wand.h header... /usr/include/ImageMagick-7/MagickWand/MagickWand.h
checking PHP version is at least 5.3.2... yes. found 8.0.0alpha1
libs
-lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI


checking for MagickGetVersion... yes
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/sh /usr/src/php/ext/imagick/libtool --mode=compile cc -I/usr/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16  -I. -I/usr/src/php/ext/imagick -DPHP_ATOM_INC -I/usr/src/php/ext/imagick/include -I/usr/src/php/ext/imagick/main -I/usr/src/php/ext/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/ImageMagick-7  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -c /usr/src/php/ext/imagick/imagick_file.c -o imagick_file.lo 
mkdir .libs
 cc -I/usr/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I. -I/usr/src/php/ext/imagick -DPHP_ATOM_INC -I/usr/src/php/ext/imagick/include -I/usr/src/php/ext/imagick/main -I/usr/src/php/ext/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/ImageMagick-7 -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c /usr/src/php/ext/imagick/imagick_file.c  -fPIC -DPIC -o .libs/imagick_file.o
In file included from /usr/src/php/ext/imagick/imagick_file.c:22:
/usr/src/php/ext/imagick/php_imagick_file.h:61:108: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   61 | zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
      |                                                                                                            ^~~~~~~~~
/usr/src/php/ext/imagick/php_imagick_file.h:65:54: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   65 | int php_imagick_safe_mode_check(const char *filename TSRMLS_DC);
      |                                                      ^~~~~~~~~
In file included from /usr/src/php/ext/imagick/imagick_file.c:22:
/usr/src/php/ext/imagick/php_imagick_file.h:68:134: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   68 | php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC);
      |                                                                                                                                      ^~~~~~~~~
/usr/src/php/ext/imagick/php_imagick_file.h:71:153: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   71 | php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC);
      |                                                                                                                                                         ^~~~~~~~~
/usr/src/php/ext/imagick/php_imagick_file.h:74:112: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   74 | zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC);
      |                                                                                                                ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:81:51: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   81 | zend_bool php_imagick_is_url(const char *filename TSRMLS_DC)
      |                                                   ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:91:108: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   91 | zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC)
      |                                                                                                            ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:160:133: error: expected ';', ',' or ')' before 'TSRMLS_DC'
  160 | int php_imagick_read_image_using_imagemagick(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
      |                                                                                                                                     ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:201:133: error: expected ';', ',' or ')' before 'TSRMLS_DC'
  201 | int php_imagick_read_image_using_php_streams(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
      |                                                                                                                                     ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:255:54: error: expected ';', ',' or ')' before 'TSRMLS_DC'
  255 | int php_imagick_safe_mode_check(const char *filename TSRMLS_DC)
      |                                                      ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:269:134: error: expected ';', ',' or ')' before 'TSRMLS_DC'
  269 | php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
      |                                                                                                                                      ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:288:153: error: expected ';', ',' or ')' before 'TSRMLS_DC'
  288 | php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC)
      |                                                                                                                                                         ^~~~~~~~~
/usr/src/php/ext/imagick/imagick_file.c:313:112: error: expected ';', ',' or ')' before 'TSRMLS_DC'
  313 | zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC)
      |                                                                                                                ^~~~~~~~~
make: *** [Makefile:210: imagick_file.lo] Error 1
The command '/bin/sh -c set -ex;         apk add --no-cache --virtual .build-deps         $PHPIZE_DEPS         freetype-dev         icu-dev         imagemagick-dev         libjpeg-turbo-dev         libpng-dev         libzip-dev 	;         docker-php-ext-configure gd --with-freetype --with-jpeg;     docker-php-ext-install -j "$(nproc)"         gd         intl         pdo_mysql         zip     > /dev/null     ;         mkdir -p /usr/src/php/ext/imagick;     curl -fsSL https://pecl.php.net/get/imagick | tar xvz -C "/usr/src/php/ext/imagick" --strip 1;     docker-php-ext-install imagick;         runDeps="$(         scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions             | tr ',' '\n'             | sort -u             | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }'     )";     apk add --virtual .redaxo-phpexts-rundeps $runDeps;     apk del .build-deps' returned a non-zero code: 2

##[error]Process completed with exit code 2.

ref FriendsOfREDAXO/docker-redaxo#20

@Danack
Copy link
Collaborator

Danack commented Aug 25, 2020

Should work now on master.

@schuer
Copy link
Author

schuer commented Aug 26, 2020

I checked the current master, the issue above was fixed, thanks!

However, there’s another one now:

/usr/src/php/ext/imagick/imagick_helpers.c: In function 'php_imagick_progress_monitor_callable':
/usr/src/php/ext/imagick/imagick_helpers.c:102:6: error: 'zend_fcall_info' {aka 'struct _zend_fcall_info'} has no member named 'named_params'; did you mean 'params'?
  fci.named_params = NULL;
      ^~~~~~~~~~~~
      params

@Danack
Copy link
Collaborator

Danack commented Aug 26, 2020

The tests are flakier than I would like, but I'm reasonably sure the code is building against php8 aka nightly.

Screen Shot 2020-08-26 at 12 53 45

struct _zend_fcall_info has no member named 'named_params';

Yes it does.

Very strong suspicion that you're compiling against PHP 7.x, and haven't done a clean phpize/configure since compiling against PHP 8.

@schuer
Copy link
Author

schuer commented Aug 26, 2020

You’re right, it works. I’ve pulled a fresh php8-rc image and can confirm Imagick’s master branch builds fine now. \o/
Sorry for the inconvenience!

mlocati added a commit to ausi/Imagine that referenced this issue Sep 14, 2020
mlocati added a commit to ausi/Imagine that referenced this issue Sep 14, 2020
@desrosj
Copy link

desrosj commented Oct 6, 2020

I think this can be closed out? Is there a plan to release a new version with the PHP 8 support included?

@Danack
Copy link
Collaborator

Danack commented Nov 25, 2020

I think this can be closed out?

I'll close it as there is another issue, but there is still stuff to do.

@Danack Danack closed this as completed Nov 25, 2020
@CryptoRhinoGH
Copy link

CryptoRhinoGH commented Dec 11, 2020

I tried installing imagick with pecl today on php8, gave me an error,

In file included from /private/tmp/pear/temp/imagick/imagick_file.c:22:
/private/tmp/pear/temp/imagick/php_imagick_file.h:61:108: error: expected ')'
zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
                                                                                                           ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:61:32: note: to match this '('
zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
                               ^

I used brew to unlink php8 and linked php7.4 which works, so that's not a problem for me, but would just like to put this out there^
Seems like one bracket causes over or equal to 20 errors causing the script to fail

MacOS Catalina, 10.15.7

@BowFarmer
Copy link

Same issue trying to install imagick with pecl on php8: one bracket causing 20 errors with the script failing. No problem with php7.4. This is on Big Sur running on a Parallels VM.

@schuer
Copy link
Author

schuer commented Dec 11, 2020

@abhisareen2002 @BowFarmer PECL version is still 3.4.4 and not working with PHP 8. You have to wait for a new release.

However, as you can read above: current master branch is working fine.

@BowFarmer
Copy link

Thank you.

@ralphschindler
Copy link

Is there a timeline on php8 support? Is there currently a blocker?

@qianz2
Copy link

qianz2 commented Jan 27, 2021

Same issue above, are there an ETA for the fix?

@fredbradley
Copy link

Save comment as above - when will there be a release that supports PHP 8?

@mbhende
Copy link

mbhende commented Feb 11, 2021

Facing similar issue, using php:8.0-fpm image on macos docker..

@schuer
Copy link
Author

schuer commented Feb 15, 2021

🐳 Docker: In case you’re still waiting for a PECL release to feed your Dockerfile, master branch indeed works fine, and docker-php-ext-install will be the magic pony:

# install imagick
# use github version for now until release from https://pecl.php.net/get/imagick is ready for PHP 8
mkdir -p /usr/src/php/ext/imagick; \
curl -fsSL https://github.com/Imagick/imagick/archive/06116aa24b76edaf6b1693198f79e6c295eda8a9.tar.gz | tar xvz -C "/usr/src/php/ext/imagick" --strip 1; \
docker-php-ext-install imagick; \

Source: https://github.com/FriendsOfREDAXO/docker-redaxo/blob/master/php8.0/apache/Dockerfile

@roxblnfk
Copy link

🐳 Docker: In case you’re still waiting for a PECL release to feed your Dockerfile, master branch indeed works fine, and docker-php-ext-install will be the magic pony:

# install imagick
# use github version for now until release from https://pecl.php.net/get/imagick is ready for PHP 8
mkdir -p /usr/src/php/ext/imagick; \
curl -fsSL https://github.com/Imagick/imagick/archive/06116aa24b76edaf6b1693198f79e6c295eda8a9.tar.gz | tar xvz -C "/usr/src/php/ext/imagick" --strip 1; \
docker-php-ext-install imagick; \

Source: https://github.com/FriendsOfREDAXO/docker-redaxo/blob/master/php8.0/apache/Dockerfile

With this config, I get several warnings, but otherwise the image builds successfully.

/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_getimagematte':
/usr/src/php/ext/imagick/imagick_class.c:299:2: warning: 'MagickGetImageMatte' is deprecated [-Wdeprecated-declarations]
  matte = MagickGetImageMatte(intern->magick_wand);
  ^~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:85:3: note: declared here
   MagickGetImageMatte(MagickWand *) magick_attribute((deprecated)),
   ^~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_paintfloodfillimage':
/usr/src/php/ext/imagick/imagick_class.c:1284:3: warning: 'MagickPaintFloodfillImage' is deprecated [-Wdeprecated-declarations]
   status = MagickPaintFloodfillImage(intern->magick_wand, channel, fill_wand, fuzz, NULL, x, y);
   ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:102:3: note: declared here
   MagickPaintFloodfillImage(MagickWand *,const ChannelType,const PixelWand *,
   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c:1292:3: warning: 'MagickPaintFloodfillImage' is deprecated [-Wdeprecated-declarations]
   status = MagickPaintFloodfillImage(intern->magick_wand, channel, fill_wand, fuzz, border_wand, x, y);
   ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:102:3: note: declared here
   MagickPaintFloodfillImage(MagickWand *,const ChannelType,const PixelWand *,
   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_recolorimage':
/usr/src/php/ext/imagick/imagick_class.c:1774:2: warning: 'MagickRecolorImage' is deprecated [-Wdeprecated-declarations]
  status = MagickRecolorImage(intern->magick_wand, order, array);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:116:3: note: declared here
   MagickRecolorImage(MagickWand *,const size_t,const double *)
   ^~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_colorfloodfillimage':
/usr/src/php/ext/imagick/imagick_class.c:4346:2: warning: 'MagickColorFloodfillImage' is deprecated [-Wdeprecated-declarations]
  status = MagickColorFloodfillImage(intern->magick_wand, fill_wand, fuzz, border_wand, x, y);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:78:3: note: declared here
   MagickColorFloodfillImage(MagickWand *,const PixelWand *,const double,
   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_mapimage':
/usr/src/php/ext/imagick/imagick_class.c:4774:2: warning: 'MagickMapImage' is deprecated [-Wdeprecated-declarations]
  status = MagickMapImage(intern->magick_wand, intern_map->magick_wand, dither);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:89:3: note: declared here
   MagickMapImage(MagickWand *,const MagickWand *,const MagickBooleanType)
   ^~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_mattefloodfillimage':
/usr/src/php/ext/imagick/imagick_class.c:4815:2: warning: 'MagickMatteFloodfillImage' is deprecated [-Wdeprecated-declarations]
  status = MagickMatteFloodfillImage(intern->magick_wand, alpha, fuzz, color_wand, x, y);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:91:3: note: declared here
   MagickMatteFloodfillImage(MagickWand *,const double,const double,
   ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_medianfilterimage':
/usr/src/php/ext/imagick/imagick_class.c:4853:2: warning: 'MagickMedianFilterImage' is deprecated [-Wdeprecated-declarations]
  status = MagickMedianFilterImage(intern->magick_wand, radius);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:88,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/magick-image.h:222:3: note: declared here
   MagickMedianFilterImage(MagickWand *,const double),
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_paintopaqueimage':
/usr/src/php/ext/imagick/imagick_class.c:4935:2: warning: 'MagickPaintOpaqueImageChannel' is deprecated [-Wdeprecated-declarations]
  status = MagickPaintOpaqueImageChannel(intern->magick_wand, channel, target_wand, fill_wand, fuzz);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:107:3: note: declared here
   MagickPaintOpaqueImageChannel(MagickWand *,const ChannelType,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_painttransparentimage':
/usr/src/php/ext/imagick/imagick_class.c:5018:2: warning: 'MagickPaintTransparentImage' is deprecated [-Wdeprecated-declarations]
  status = MagickPaintTransparentImage(intern->magick_wand, color_wand, alpha, fuzz);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:110:3: note: declared here
   MagickPaintTransparentImage(MagickWand *,const PixelWand *,const double,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_reducenoiseimage':
/usr/src/php/ext/imagick/imagick_class.c:5182:2: warning: 'MagickReduceNoiseImage' is deprecated [-Wdeprecated-declarations]
  status = MagickReduceNoiseImage(intern->magick_wand, radius);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:88,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/magick-image.h:269:3: note: declared here
   MagickReduceNoiseImage(MagickWand *,const double),
   ^~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_getimageattribute':
/usr/src/php/ext/imagick/imagick_class.c:6512:2: warning: 'MagickGetImageAttribute' is deprecated [-Wdeprecated-declarations]
  attribute = MagickGetImageAttribute(intern->magick_wand, key);
  ^~~~~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:62:4: note: declared here
   *MagickGetImageAttribute(MagickWand *,const char *)
    ^~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_getimagechannelextrema':
/usr/src/php/ext/imagick/imagick_class.c:6729:2: warning: 'MagickGetImageChannelExtrema' is deprecated [-Wdeprecated-declarations]
  status = MagickGetImageChannelExtrema(intern->magick_wand, channel_type, &minima, &maxima);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:81:3: note: declared here
   MagickGetImageChannelExtrema(MagickWand *,const ChannelType,size_t *,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_getimageextrema':
/usr/src/php/ext/imagick/imagick_class.c:7070:2: warning: 'MagickGetImageExtrema' is deprecated [-Wdeprecated-declarations]
  status = MagickGetImageExtrema(intern->magick_wand, &min, &max);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:83:3: note: declared here
   MagickGetImageExtrema(MagickWand *,size_t *,size_t *)
   ^~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_getimageindex':
/usr/src/php/ext/imagick/imagick_class.c:8182:2: warning: 'MagickGetImageIndex' is deprecated [-Wdeprecated-declarations]
  status = MagickGetImageIndex(intern->magick_wand);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:68:3: note: declared here
   MagickGetImageIndex(MagickWand *) magick_attribute((deprecated));
   ^~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_getimagesize':
/usr/src/php/ext/imagick/imagick_class.c:8303:2: warning: 'MagickGetImageSize' is deprecated [-Wdeprecated-declarations]
  ZVAL_LONG(return_value, (long)MagickGetImageSize(intern->magick_wand));
  ^~~~~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:147:3: note: declared here
   MagickGetImageSize(MagickWand *) magick_attribute((deprecated));
   ^~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_setimageattribute':
/usr/src/php/ext/imagick/imagick_class.c:8777:2: warning: 'MagickSetImageAttribute' is deprecated [-Wdeprecated-declarations]
  status = MagickSetImageAttribute(intern->magick_wand, key, attribute);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:118:3: note: declared here
   MagickSetImageAttribute(MagickWand *,const char *,const char *)
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_flattenimages':
/usr/src/php/ext/imagick/imagick_class.c:9152:2: warning: 'MagickFlattenImages' is deprecated [-Wdeprecated-declarations]
  tmp_wand = MagickFlattenImages(intern->magick_wand);
  ^~~~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:139:4: note: declared here
   *MagickFlattenImages(MagickWand *) magick_attribute((deprecated)),
    ^~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_averageimages':
/usr/src/php/ext/imagick/imagick_class.c:10339:2: warning: 'MagickAverageImages' is deprecated [-Wdeprecated-declarations]
  tmp_wand = MagickAverageImages(intern->magick_wand);
  ^~~~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:138:4: note: declared here
   *MagickAverageImages(MagickWand *) magick_attribute((deprecated)),
    ^~~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_mosaicimages':
/usr/src/php/ext/imagick/imagick_class.c:10842:2: warning: 'MagickMosaicImages' is deprecated [-Wdeprecated-declarations]
  tmp_wand = MagickMosaicImages(intern->magick_wand);
  ^~~~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:142:4: note: declared here
   *MagickMosaicImages(MagickWand *) magick_attribute((deprecated)),
    ^~~~~~~~~~~~~~~~~~
/usr/src/php/ext/imagick/imagick_class.c: In function 'zim_imagick_radialblurimage':
/usr/src/php/ext/imagick/imagick_class.c:10972:2: warning: 'MagickRadialBlurImageChannel' is deprecated [-Wdeprecated-declarations]
  status = MagickRadialBlurImageChannel(intern->magick_wand, channel, angle);
  ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:82,
                 from /usr/src/php/ext/imagick/php_imagick_defs.h:29,
                 from /usr/src/php/ext/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:114:3: note: declared here
   MagickRadialBlurImageChannel(MagickWand *,const ChannelType,const double)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

@mbhende
Copy link

mbhende commented Feb 24, 2021

Update : I installed from the master branch and it worked properly . Writing the steps in simpler commands for easy understanding here :

git clone https://github.com/Imagick/imagick
cd imagick
phpize && ./configure
make
make install
cd ../
rm -rf imagick
docker-php-ext-enable imagick

@lebadapetru
Copy link

Update : I installed from the master branch and it worked properly . Writing the steps in simpler commands for easy understanding here :

git clone https://github.com/Imagick/imagick
cd imagick
phpize && ./configure
make
make install
cd ../
rm -rf imagick
docker-php-ext-enable imagick

I'm trying to install it in a php8-alpine dockerfile using those steps but i receive the following error:

 => ERROR [base 15/26] RUN phpize && ./configure                           0.3s
------
 > [base 15/26] RUN phpize && ./configure:
#18 0.233 Cannot find config.m4.
#18 0.233 Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
#18 0.233
------
ERROR: Service 'php' failed to build

The full instructions is:

RUN git clone https://github.com/Imagick/imagick
RUN cd imagick
RUN ls
RUN phpize && ./configure
RUN make
RUN make install
RUN cd ../
RUN rm -rf imagick
RUN docker-php-ext-enable imagick

Does anyone know how to fix this?

@rufinus
Copy link

rufinus commented Mar 16, 2021

@lebadapetru
Don't use RUN for every line - this will lead to a lot of small container parts which have to be downloaded - but dont have much reusability.

i just used this (on an alpine image) with 8.0.3

RUN set -xe \
 && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
 && apk add --no-cache bash imagemagick-dev \
 && git clone https://github.com/Imagick/imagick \
 && cd imagick \
 && git checkout master && git pull \
 && phpize && ./configure && make && make install \
 && cd .. && rm -Rf imagick \
 && docker-php-ext-enable imagick \
 && apk del .build-deps \
 && rm -rf /tmp/* /var/cache/apk/* 

~

@lebadapetru
Copy link

lebadapetru commented Mar 17, 2021

@lebadapetru
Don't use RUN for every line - this will lead to a lot of small container parts which have to be downloaded - but dont have much reusability.

i just used this (on an alpine image) with 8.0.3

RUN set -xe \
 && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
 && apk add --no-cache bash imagemagick-dev \
 && git clone https://github.com/Imagick/imagick \
 && cd imagick \
 && git checkout master && git pull \
 && phpize && ./configure && make && make install \
 && cd .. && rm -Rf imagick \
 && docker-php-ext-enable imagick \
 && apk del .build-deps \
 && rm -rf /tmp/* /var/cache/apk/* 

~

Hey @rufinus, thx for your help.
The installation worked and i can see it listed:

imagemagick-c++-7.0.10.57-r0 - ImageMagick Magick++ library (C++ bindings)
imagemagick-dev-7.0.10.57-r0 - Collection of tools and libraries for many image formats (development files)
imagemagick-libs-7.0.10.57-r0 - Collection of tools and libraries for many image formats (libraries)

but none of the imagick commands work in the container ( magick, convert, identify, etc ), nor in my project ( though phpinfo lists imagick as installed module ).

From phpinfo:


imagick module | enabled
-- | --
imagick module version | @PACKAGE_VERSION@
imagick classes | Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version | ImageMagick 7.0.10-57 Q16 x86_64 2021-01-10 https://imagemagick.org
Imagick using ImageMagick library version | ImageMagick 7.0.10-57 Q16 x86_64 2021-01-10 https://imagemagick.org
ImageMagick copyright | © 1999-2021 ImageMagick Studio LLC
ImageMagick release date | 2021-01-10
ImageMagick number of supported formats: | 0

The number of supported formats is 0..., shouldn't jpg,png and a few others be supported by default? I've installed them in my container:

RUN apk add --no-cache \
    postgresql \
    postgresql-dev \
    libzip-dev \
    zlib-dev \
    git \
    zip \
    g++ \
    gettext \
    gettext-dev \
    icu-dev\
    php7-intl \
    nodejs \
    nodejs-npm \
    libjpeg-turbo-dev \
    jpeg-dev \
    libpng-dev \
    ffmpeg \
    perl-image-exiftool \
&& docker-php-ext-install \
    pdo_pgsql \
    pgsql \
    gettext \
    intl \
    opcache \
    zip \
&& docker-php-ext-configure intl \
&& docker-php-ext-configure gettext \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-enable opcache

@rufinus
Copy link

rufinus commented Mar 17, 2021

@lebadapetru what has the one todo with the other? the module lets you use imagemagick lib in php see https://www.php.net/manual/en/imagick.examples-1.php

If you only want to use the bin files via exec its enough to install them with apk add --no-cache imagemagick (currently you only have the development headers and libaries installed - needed for the php module to work/compile)

@lebadapetru
Copy link

lebadapetru commented Mar 17, 2021

@rufinus, yeah, i've got a bit confuse at some point and i really thought i had imagemagick installed when in fact i had only imagick and once i received NoDecodeDelegateForThisImageFormat JPEG' @ error/constitute.c/ReadImage/572 in my project i started worrying, but seems like i was missing imagemagick. Thank you so much for your assistance

@bertoost
Copy link

I am trying to install Imagick in a PHP docker image based on PHP's official image php:8.0.3-fpm-alpine3.13
Installing with @rufinus his tips are working for me. Therefore the application I use (Craft CMS) is saying that ImageMagick is not installed. When I run a phpinfo() I see it is there, thefore no package version?

image

Anyone any idea how to fix it?

@meglio
Copy link

meglio commented Apr 3, 2021

Also throws errors for me when I install Imagic in a container based on php:8.0.3-fpm:

image

@juan88
Copy link

juan88 commented Apr 6, 2021

I am trying to install Imagick in a PHP docker image based on PHP's official image php:8.0.3-fpm-alpine3.13
Installing with @rufinus his tips are working for me. Therefore the application I use (Craft CMS) is saying that ImageMagick is not installed. When I run a phpinfo() I see it is there, thefore no package version?

image

Anyone any idea how to fix it?

I'm having the same issue as well with that container.

Above that image I'm installing imagemagick and imagemagick-dev through apk and imagick is being installed through pecl.

daohoangson added a commit to xfrocks/docker-xenforo that referenced this issue May 8, 2021
@Moep90
Copy link

Moep90 commented Sep 1, 2021

Working for me on the latest version

Dockerfile

FROM nextcloud:fpm-alpine
RUN apk --no-cache \
        --update add \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
        php8-pdlib php8-pecl-imagick bzip2-dev php8-pecl-redis \
  && \
    docker-php-ext-install bz2 \
  && \
    echo 'extension=/usr/lib/php8/modules/pdlib.so' > /usr/local/etc/php/conf.d/pdlib.ini

Test

$ php occ face:background_job -t 60
1/10 - Executing task CheckRequirementsTask (Check all requirements)
2/10 - Executing task CheckCronTask (Check that service is started from either cron or from command)
3/10 - Executing task LockTask (Acquire lock so that only one background task can run)
4/10 - Executing task DisabledUserRemovalTask (Purge all the information of a user when disable the analysis.)
5/10 - Executing task StaleImagesRemovalTask (Crawl for stale images (either missing in filesystem or under .nomedia) and remove them from DB)
6/10 - Executing task CreateClustersTask (Create new persons or update existing persons)
	Clusters already exist, estimated there is no need to recreate them
	Skipping cluster creation, not enough data (yet) collected. For cluster creation, you need either one of the following:
	* have 1000 faces already processed
	* or you need to have 95% of you images processed
	Use stats command to track progress
	Skipping cluster creation, not enough data (yet) collected. For cluster creation, you need either one of the following:
	* have 1000 faces already processed
	* or you need to have 95% of you images processed
	Use stats command to track progress
7/10 - Executing task AddMissingImagesTask (Crawl for missing images for each user and insert them in DB)
	Skipping image scan for user userX that has disabled the analysis
	Skipping image scan for user adminX that has disabled the analysis
8/10 - Executing task EnumerateImagesMissingFacesTask (Find all images which don't have faces generated for them)
9/10 - Executing task ImageProcessingTask (Process all images to extract faces)
	NOTE: Starting face recognition. If you experience random crashes after this point, please look FAQ at https://github.com/matiasdelellis/facerecognition/wiki/FAQ
10/10 - Executing task UnlockTask (Release obtained lock)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests