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

xdebug installation fails on 8.x debian (missing lib/php-header.h) #613

Closed
schmunk42 opened this issue Jul 21, 2022 · 19 comments
Closed

xdebug installation fails on 8.x debian (missing lib/php-header.h) #613

schmunk42 opened this issue Jul 21, 2022 · 19 comments
Labels
bug Something isn't working

Comments

@schmunk42
Copy link

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
@schmunk42 schmunk42 added the bug Something isn't working label Jul 21, 2022
@CodeCasterNL
Copy link

CodeCasterNL commented Jul 21, 2022

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

@b1rdex
Copy link
Contributor

b1rdex commented Jul 21, 2022

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?

@schmunk42
Copy link
Author

@mlocati @CodeCasterNL I tried to modify all extension installations to -stable.

But with this image https://github.com/yiisoft/yii2-docker/actions/runs/2718005323 I run into problems for PHP <7.2 now.

Actually either I should be able to install a stable version of the extension for all PHP versions.
Or as mentioned by @b1rdex I should explicitly tell the installer that I want a alpha or beta version.

@schmunk42
Copy link
Author

I am reopening this, please let us know if we should create a new ticket for the issues described above.

@schmunk42 schmunk42 reopened this Jul 22, 2022
@CodeCasterNL
Copy link

@schmunk42

INSTALLING REMOTE MODULE mongodb

(installing version stable)
pecl/mongodb requires PHP (version >= 7.2.0, version <= 8.99.99), installed version is 7.1.33

That's a different issue AFAIK.

@schmunk42
Copy link
Author

schmunk42 commented Jul 22, 2022

Yes, but I am stuck there, because I can not build all images from 5.6 to 8.1, due to the fact that for 8.x it tries to install the 3.2alpha.

That's why I followed your advice also there to use -stable but this leads to the error you just mentioned.

If I just use it for xdebug-stable it still fails below 7.2, see https://github.com/yiisoft/yii2-docker/runs/7466830525?check_suite_focus=true

@igoooor
Copy link

igoooor commented Jul 22, 2022

Issue is not resolved for me using php:8.1.8-fpm-alpine3.16
RUN install-php-extensions xdebug
exits with:

The command '/bin/sh -c install-php-extensions xdebug' returned a non-zero code: 1
2022-07-22T11:08:12.549574363Z stdout P 2: configure: error: rtnetlink.h is required, install the linux-headers package: apk add --update linux-headers

Do we need to do any extra step to have it working agian?

@b1rdex
Copy link
Contributor

b1rdex commented Jul 22, 2022

@igoooor use xdebug-stable

@igoooor
Copy link

igoooor commented Jul 22, 2022

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

@CodeCasterNL
Copy link

Yes, but I am stuck there, because I can not build all images from 5.6 to 8.1, due to the fact that for 8.x it tries to install the 3.2alpha.

That's why I followed your advice also there to use -stable but this leads to the error you just mentioned.

If I just use it for xdebug-stable it still fails below 7.2, see https://github.com/yiisoft/yii2-docker/runs/7466830525?check_suite_focus=true

So two days ago it used to work? Did it detect the PHP version and according Mongo (and other extension) version or did Mongo recently publish a new version that won't work with PHP < 7.2?

@b1rdex
Copy link
Contributor

b1rdex commented Jul 22, 2022

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: add missing php-header.h file for PECL package xdebug/xdebug#851 and that's why it errors on install
  2. pickle has a bug – it picks not a stable version by default: Pickle picks RC instead of latest stable FriendsOfPHP/pickle#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 :D

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

@schmunk42
Copy link
Author

So two days ago it used to work? Did it detect the PHP version and according Mongo (and other extension) version or did Mongo recently publish a new version that won't work with PHP < 7.2?

Yes, these builds went just fine: https://github.com/yiisoft/yii2-docker/actions/runs/2702056407
(Note: There are ENVs for specific versions, but they are unused AFAIR)

Then, 2 days ago, the 8.x builds broke, due to the alpha version.

@CodeCasterNL
Copy link

@schmunk42
Your build (7.1-fpm, debian, 1, -2.9.8) on 2022-07-20 installed mongodb 1.11, which is PHP 7.1 compatible.

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

pecl/mongodb requires PHP (version >= 7.2.0, version <= 8.99.99), installed version is 7.1.33

This would indicate that it (but which "it"? Pickle?) doesn't properly detect the PHP version in use anymore to determine the extension version to install, and that it tries to install 1.12 or up (which dropped PHP 7.1 support).

@schmunk42
Copy link
Author

schmunk42 commented Jul 22, 2022

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

That's because I also added -stable to mongodb, see yiisoft/yii2-docker@844bca2#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.

@b1rdex
Copy link
Contributor

b1rdex commented Jul 22, 2022

Okay, looks like I figured out the problem with pickle and prepared a fix – FriendsOfPHP/pickle#259
Please review/test it if you have a possibility.

@mlocati
Copy link
Owner

mlocati commented Aug 2, 2022

I'm closing this issue, since it's not related to the install-php-extensions (see https://bugs.xdebug.org/view.php?id=2105 and FriendsOfPHP/pickle#247 instead)

@mlocati mlocati closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2022
@schmunk42
Copy link
Author

@mlocati Just to understand how things work under the hood...

This needs to be fixed in pickle and/or xdebug itself, right?
If it is fixed, do they need to release a new version so the extension installer will pick up the fix?

@mlocati
Copy link
Owner

mlocati commented Aug 2, 2022

The xdebug bug has already been fixed in the latest beta version, but pickle should install the last stable version by default.

@b1rdex
Copy link
Contributor

b1rdex commented Aug 3, 2022

but pickle should install the last stable version by default

I created a PR to fix that, please review when you have time: FriendsOfPHP/pickle#259

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

5 participants