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

Error compiling imagick extension in PHP 8.4 #1048

Closed
javespi opened this issue Jan 22, 2025 · 1 comment
Closed

Error compiling imagick extension in PHP 8.4 #1048

javespi opened this issue Jan 22, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@javespi
Copy link
Contributor

javespi commented Jan 22, 2025

Version of install-php-extensions

v2.7.14

Error description

Error when installing imagick in a PHP 8.4 image:

...
 cc -I. -I/tmp/pear/temp/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 -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -I/usr/include/ImageMagick-7 -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_CHANNEL_MASK_DEPTH=32 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/imagick/imagickpixel_class.c -MMD -MF imagickpixel_class.dep -MT imagickpixel_class.lo  -fPIC -DPIC -o .libs/imagickpixel_class.o
 cc -I. -I/tmp/pear/temp/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 -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -I/usr/include/ImageMagick-7 -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_CHANNEL_MASK_DEPTH=32 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/imagick/imagick_file.c -MMD -MF imagick_file.dep -MT imagick_file.lo  -fPIC -DPIC -o .libs/imagick_file.o
/tmp/pear/temp/imagick/imagick.c: In function 'php_imagick_read_property':
/tmp/pear/temp/imagick/imagick.c:606:49: error: implicit declaration of function 'php_strtolower'; did you mean 'php_strtok_r'? [-Wimplicit-function-declaration]
  606 |                                                 php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
      |                                                 ^~~~~~~~~~~~~~
      |                                                 php_strtok_r
make: *** [Makefile:222: imagick.lo] Error 1
make: *** Waiting for unfinished jobs....
ERROR: `make -j16' failed

Looks like it is related to this issue:

where php_strtolower is no longer supported in PHP 8.4

There is a possible workaround until new version of imagick is released passing CPP flags replacing the function to the zend one which is backward compatible with previous versions:

./configure CPPFLAGS='-Dphp_strtolower=zend_str_tolower'

But I am not sure where I could add this flag for imagick


Happy to open a PR to solve this 😄

Checking the code not sure what is best:

  • Adding a new installImagick function to do it manually
  • Not sure how can I add a CPP flag in processPHPModuleArgument() function
  • Add new case for imagick) inside installRemoteModule() function with the installRemoteModule_cppflags argument

Docker image

php:8.4-fpm-alpine

Minimal Dockerfile

RUN chmod +x /usr/local/bin/install-php-extensions && \
    install-php-extensions opcache bcmath gmp curl intl pcntl exif soap mcrypt newrelic pdo_mysql-^1 pdo_pgsql-^1 sockets zip-^1 amqp-^2 apcu-^5 event-^3 mongodb-^1 grpc-1.64.1 gd-^2 imagick/imagick@28f27044e435a2b203e32675e942eb8de620ee58
    install-php-extensions opcache bcmath gmp curl intl pcntl exif soap newrelic pdo_mysql-^1 pdo_pgsql-^1 sockets zip-^1 amqp-^2 apcu-^5 event-^3 mongodb-^1 grpc-^1 gd-^2 imagick/imagick@28f27044e435a2b203e32675e942eb8de620ee58
@javespi javespi added the bug Something isn't working label Jan 22, 2025
Copy link

Version of install-php-extensions

latest

@javespi the install-php-extensions version that you specified (latest) is not valid.

Please specify the install-php-extensions version you are using: it's the first line printed by the script.
For example:

install-php-extensions v.X.Y.Z

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant