Odd error installing xdebug while building an 8.2 container in gitlab CI
Closed this issue · 6 comments
Version of install-php-extensions
v.1.5.51
Error description
When attempting to install xdebug in php:8.2 while building a container in gitlab CI I'm getting an odd error:
2: /tmp/pickle.tmp/xdebug/xdebug-3.2.0/src/lib/usefulstuff.c:1153: error: unterminated #else
2: 1153 | #ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */
2: |
2: make: *** [Makefile:270: src/lib/usefulstuff.lo] Error 1The command '/bin/sh -c /usr/local/bin/install-php-extensions ${EXTENSIONS} @composer' returned a non-zero code: 1
The full output can be seen here: https://gitlab.com/portlandlabs/containers/-/jobs/3479191268
For some reason I'm able to build this container without issue locally, this issue only shows up in gitlab CI.
Docker image
php:8.2
Minimal Dockerfile
https://gitlab.com/portlandlabs/containers/-/blob/main/php/default/Dockerfile
where:
- `BASE_IMAGE` = `php:8.2`
- `EXTENSIONS` = `mbstring curl intl gd xml zip bz2 pdo_mysql xdebug redis amqp`
I've never seen such an error, and I can't reproduce it.
Maybe a temporary network occurred and the file downloaded from PECL are broken?
Have you tried to re-launch the job?
This error happened all day yesterday and this morning ~5 hours ago, I'm rerunning it now here: https://gitlab.com/portlandlabs/containers/-/jobs/3481480498
Could there be a cache on the server running the DIND container that needs to be cleared? This same server seems to do fine building 8.1+xdebug containers so I'm not sure what to poke at next.
I get the same error with a more minimal set up https://gitlab.com/portlandlabs/containers/-/jobs/3481570207:
FROM php:8.2
ADD https://github.com/mlocati/docker-php-extension-installer/releases/download/1.5.51/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions
RUN /usr/local/bin/install-php-extensions xdebug
image: docker:20.10.16
variables:
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:20.10.16-dind
before_script:
- docker info
stages:
- "build"
build:php:8.2:
stage: build
tags:
- dind
script:
- docker build --no-cache -t test .
One odd thing about this is the errors seem to point to lines of code that don't exist in certain files. One fatal error is directly related to this:
2: /tmp/pickle.tmp/xdebug/xdebug-3.2.0/src/base/filter.c:346:10: fatal error: mm.h: No such file or directory
2: 346 | #include "mm.h"
2: | ^~~~~~
2: compilation terminated.
Note that the line it's complaining about isn't actually in base/filter.c
instead it's in lib/str.c
so the relative include #include "mm.h"
ends up fataling since it's relative to base
rather than the intended lib
directory.
Another interesting tidbit, installing xdebug directly using:
RUN pecl install xdebug
RUN echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini
works fine, it's just installing xdebug with php-extension-installer having trouble
It looks like this issue exists when using pickle directly:
RUN /usr/local/bin/pickle.phar install xdebug --no-interaction
So the problem stems from there