docker-php-extension-installer: xdebug installation fails on 8.x debian (missing lib/php-header.h)

Version of install-php-extensions

v.1.5.29

Error description

Build fails in Docker build for RUN install-php-extensions xdebug. With fatal error: lib/php-header.h: No such file or directory

See for example https://github.com/yiisoft/yii-docker/runs/7444548717?check_suite_focus=true#step:6:752 - also tested with the command above.

2: compilation terminated.
2: make: *** [Makefile:286: src/lib/lib.lo] Error 1
2:  cc -I. -I/tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1 -I/tmp/pickle.tmp/pickle-7f747bef79dcb11e3af9f2d35a5c23574d431cf4/include -I/tmp/pickle.tmp/pickle-7f747bef79dcb11e3af9f2d35a5c23574d431cf4/main -I/tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1 -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/tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1/src -I/tmp/pickle.tmp/pickle-7f747bef79dcb11e3af9f2d35a5c23574d431cf4/src -DHAVE_CONFIG_H -g -O2 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1/src/lib/usefulstuff.c -MMD -MF src/lib/usefulstuff.dep -MT src/lib/usefulstuff.lo  -fPIC -DPIC -o src/lib/.libs/usefulstuff.o
2: make: *** [Makefile:304: src/lib/var.lo] Error 1
2: make: *** [Makefile:262: src/base/base.lo] Error 1
2: /tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1/src/lib/compat.c:42:10: fatal error: lib/php-header.h: No such file or directory
2:    42 | #include "lib/php-header.h"
2:       |          ^~~~~~~~~~~~~~~~~~
2: compilation terminated.
2: make: *** [Makefile:271: src/lib/compat.lo] Error 1
2: /tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1/src/lib/str.c:23:10: fatal error: lib/php-header.h: No such file or directory
2:    23 | #include "lib/php-header.h"
2:       |          ^~~~~~~~~~~~~~~~~~
2: compilation terminated.
2: make: *** [Makefile:298: src/lib/str.lo] Error 1
2: In file included from /tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1/src/lib/usefulstuff.c:33:
2: /tmp/pickle.tmp/xdebug/xdebug-3.2.0alpha1/php_xdebug.h:28:10: fatal error: lib/php-header.h: No such file or directory
2:    28 | #include "lib/php-header.h"
2:       |          ^~~~~~~~~~~~~~~~~~
2: compilation terminated.
2: make: *** [Makefile:268: src/lib/usefulstuff.lo] Error 1The command '/bin/sh -c install-php-extensions         xdebug' returned a non-zero code: 1

Docker image

php:8.x

Minimal Dockerfile

FROM php:8.1-apache
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions \
        xdebug

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 19 (7 by maintainers)

Commits related to this issue

Most upvoted comments

thanks for the quick answer. Is that a temporary fix, or should I always use xdebug-stable from now on?

@igoooor this issue consist of multiple problems.

  1. xdebug alpha release is missing a file: https://github.com/xdebug/xdebug/pull/851 and that’s why it errors on install
  2. pickle has a bug – it picks not a stable version by default: https://github.com/FriendsOfPHP/pickle/issues/247 (and that’s why xdebug-alpha is installed)

If xdebug alpha release had no errors, then you’d silently get an alpha version this thread wouldn’t exist at all 😄

So this is not a docker-php-extension-installer issue at all. I’ll try to dig the problem with pickle.

Docs:

Pre-release versions extensions available on PECL can be setup by suffixing the extension’s name with its state i.e. alpha, beta, rc, preview, devel or snapshot. […] When the latest version available on PECL is not stable, and you want to keep the last stable version, force it by suffixing the extension’s name with the stable state.

The latest xdebug release on PECL (3.2.0alpha, 2022-07-20) is not stable, but alpha.

A workaround until that’s fixed would be to tag a specific version:

install-php-extensions xdebug-^3.1

Or require stable:

install-php-extensions xdebug-stable

On an image building on 8.1:fpm-alpine, the error was:

configure: error: rtnetlink.h is required, install the linux-headers package: apk add --update linux-headers

Build (7.1-fpm, debian, 1, -2.9.8) today failed with

That’s because I also added -stable to mongodb, see https://github.com/yiisoft/yii2-docker/commit/844bca2c713da69f0bb792c1298dcc3b6ab57c3f#diff-ed02e61dc347b6860c1d27ec862b61edbaf946278dcf92348a5a1a4a4c05f3f8R59

Because I thought that would be the proper way to install a stable version for the installed PHP version. But it looks to me like it just picks the very latest stable version of the extension and does not care about the PHP version.

Having the same problem with Alpine. image

Actually, this is kinda strange, because the version is marked as beta on pecl: image

For me install xdebug that prints (installing version stable) should not install beta versions 😃

@mlocati, what do you think about the issue?