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

PHP 8: Cannot install Imagick in Alpine #1033

Closed
schuer opened this issue Jul 4, 2020 · 4 comments
Closed

PHP 8: Cannot install Imagick in Alpine #1033

schuer opened this issue Jul 4, 2020 · 4 comments

Comments

@schuer
Copy link

schuer commented Jul 4, 2020

Hi, I’ve tested our REDAXO CMS with your brand new php 8.0-rc images, and everything works fine (thanks!). Only I can’t get Alpine to install Imagick, since docker-php-ext-install imagick throws errors like:

/usr/src/php/ext/imagick/php_imagick_file.h:61:108: error: expected ';', ',' or ')' before 'TSRMLS_DC'

Any idea how to fix it? Thaaaanks!

Souce:

# install imagick
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; \

Dockerfile: https://github.com/FriendsOfREDAXO/docker-redaxo/blob/schuer-php8/php8.0-rc/fpm-alpine/Dockerfile

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

@wglambert
Copy link

I get the same error on the Debian variant, perhaps it's not compatible with php 8 yet

You could try making an issue over at https://github.com/ImageMagick/ImageMagick/issues

@tianon
Copy link
Member

tianon commented Jul 6, 2020

I think https://github.com/Imagick/imagick is the appropriate place for the PHP extension specifically. 😅

@schuer
Copy link
Author

schuer commented Jul 6, 2020

Thanks for your feedback! Just to get it right: don’t you think the issue is either PHP 8 and/or docker-php-ext-install related?

@tianon
Copy link
Member

tianon commented Jul 6, 2020

It's absolutely related to PHP 8, but very unlikely to be docker-php-ext-install (which simply performs the documented steps for installing an external PHP module, namely phpize + ./configure + make + make install).

The folks who maintain the imagick module will be in the best position to determine if there's something that needs to change in their module to support PHP 8, or whether there's something inherent in PHP 8 that needs to be fixed (although I'd wager that the latter is much less likely).

@tianon tianon closed this as completed Jul 6, 2020
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

3 participants