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

PHP8.3 and imagick extension #109

Open
timo002 opened this issue Oct 17, 2024 · 2 comments
Open

PHP8.3 and imagick extension #109

timo002 opened this issue Oct 17, 2024 · 2 comments

Comments

@timo002
Copy link

timo002 commented Oct 17, 2024

Building the docker image with PHP 8.3 and the imagick extension fails.

46.35 Saved /tmp/pear/temp/imagick/ImagickPixelIterator_arginfo.h
46.35 Saved /tmp/pear/temp/imagick/ImagickKernel_arginfo.h
46.36 Saved /tmp/pear/temp/imagick/ImagickPixel_arginfo.h
46.36 Saved /tmp/pear/temp/imagick/ImagickDraw_arginfo.h
46.37 In /tmp/pear/temp/imagick/Imagick.stub.php:
46.37 Unterminated preprocessor conditions
46.37 make: *** [Makefile:196: /tmp/pear/temp/imagick/Imagick_arginfo.h] Error 1
46.38 ERROR: `make -j8 INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuserffEDHg/install-imagick-3.7.0" install' failed
------
failed to solve: process "/bin/sh -c apk add --no-cache --virtual .persistent-deps     fcgi     git     openssh-client     patch     && chmod +x /usr/local/bin/install-php-extensions     && install-php-extensions             imagick             APCu-stable             bcmath-stable             exif-stable             gettext-stable             gmp-stable             intl-stable             opcache-stable             pcntl-stable             pdo_mysql-stable             redis-stable             shmop-stable             soap-stable             sockets-stable             sysvmsg-stable             sysvsem-stable             sysvshm-stable             xsl-stable             mysqli-stable             memcached-stable             gd-stable             zip-stable             calendar-stable             igbinary-stable             msgpack-stable             ssh2-stable     && docker-php-source delete     && apk --no-cache -U upgrade     && rm -rf /tmp/*     && addgroup -g $LOCAL_GROUP_ID -S qlico     && adduser -u $LOCAL_USER_ID -S qlico -G qlico     && mkdir -p /php-socket     && chown qlico:qlico /php-socket" did not complete successfully: exit code: 1

See also this issue: Imagick/imagick#641

The workarounds provided in this issue don't seem to work either:

 => ERROR [php base  6/11] RUN curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz     && tar --strip-components=1 -xf /tmp/imagick.tar.gz     && phpize     && ./configure     && make   0.8s
------
 > [php base  6/11] RUN curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz     && tar --strip-components=1 -xf /tmp/imagick.tar.gz     && phpize     && ./configure     && make     && make install     && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini     && rm -rf /tmp/*:
0.128   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
0.128                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  369k    0  369k    0     0   682k      0 --:--:-- --:--:-- --:--:--  682k
0.708 Configuring for:
0.709 PHP Api Version:         20230831
0.709 Zend Module Api No:      20230831
0.709 Zend Extension Api No:   420230831
0.721 Cannot find autoconf. Please check your autoconf installation and the
0.721 $PHP_AUTOCONF environment variable. Then, rerun this script.
0.721
------
failed to solve: process "/bin/sh -c curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/${IMAGICK_VERSION}.tar.gz     && tar --strip-components=1 -xf /tmp/imagick.tar.gz     && phpize     && ./configure     && make     && make install     && echo \"extension=imagick.so\" > /usr/local/etc/php/conf.d/ext-imagick.ini     && rm -rf /tmp/*" did not complete successfully: exit code: 1
@timo002
Copy link
Author

timo002 commented Oct 17, 2024

Seems to be fixed by adding this to the Dockerfile:

RUN apk add --no-cache autoconf automake build-base libtool imagemagick-dev

ARG IMAGICK_VERSION=3.7.0

# Imagick is installed from the archive because regular installation fails
# See: https://github.com/Imagick/imagick/issues/643#issuecomment-1834361716
RUN curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/${IMAGICK_VERSION}.tar.gz \
    && tar --strip-components=1 -xf /tmp/imagick.tar.gz \
    && phpize \
    && ./configure \
    && make \
    && make install \
    && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \
    && rm -rf /tmp/*
    # <<< End of Imagick installation

@bigfoot90
Copy link

Works on Apple Silicon M1

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

2 participants