ddev / ddev

Docker-based local PHP+Node.js web development environments
https://ddev.com
Apache License 2.0
2.43k stars 579 forks source link

build: compile Xdebug 3.2.2 for PHP 8.0, 8.1, 8.2, fixes #6159 #6181

Closed stasadev closed 2 weeks ago

stasadev commented 2 weeks ago

The Issue

How This PR Solves The Issue

Compiles Xdebug 3.2.2 library for PHP 8.0, 8.1, 8.2.

Unfortunately we can't build Xdebug 3.2.2 for PHP 8.3:

checking Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 8.0.0 and < 8.3.0 (found 8.3.7)

Xdebug Compatibility https://xdebug.org/docs/compat

Manual Testing Instructions

# check Xdebug library files in DDEV HEAD
ddev exec ls -l $(ddev exec dpkg-query -L php{8.0,8.1,8.2}-xdebug | grep xdebug.so)
# or
docker run --rm -it ddev/ddev-php-base:20240513_stasadev_debsuryorg bash -c 'ls -l $(find / -iname xdebug.so)'

# check Xdebug library files in this PR
ddev exec ls -l /usr/lib/php/20200930/xdebug.so /usr/lib/php/20210902/xdebug.so /usr/lib/php/20220829/xdebug.so
# or
docker run --rm -it ddev/ddev-php-base:v1.23.1 bash -c 'ls -l $(find / -iname xdebug.so)'

ddev config --php-version 8.2 && ddev restart && ddev xdebug && ddev php -v
ddev config --php-version 8.1 && ddev restart && ddev xdebug && ddev php -v
ddev config --php-version 8.0 && ddev restart && ddev xdebug && ddev php -v

Automated Testing Overview

Related Issue Link(s)

Release/Deployment Notes

stasadev commented 2 weeks ago

I will make a new build of the Docker image only after the next PR goes in:

stasadev commented 2 weeks ago

And it can be tested manually using .ddev/web-build/Dockerfile

rfay commented 2 weeks ago

Please open an issue with https://bugs.xdebug.org/my_view_page.php explaining your results with php 8.3, thanks!

stasadev commented 2 weeks ago

Please open an issue with bugs.xdebug.org/my_view_page.php explaining your results with php 8.3, thanks!

It's not compatible (see https://xdebug.org/docs/compat) so they won't fix it.

rfay commented 2 weeks ago

Oh, I understand now, thanks.

stasadev commented 2 weeks ago

I added a new stage for Xdebug, because the size of the Docker image ddev-php-base has grown significantly:

linux/amd64 333.86 MB => 426.51 MB linux/arm64 327.2 MB => 414 MB

Also I added cleanup for /tmp/*, because there were leftovers from platformsh:

$ docker run --rm -it ddev/ddev-webserver:v1.23.0-1 ls -la /tmp
total 40
drwxrwxrwt 2 root root  4096 Apr 16 18:31 .
drwxr-xr-x 1 root root  4096 May 14 10:54 ..
-rw-r--r-- 1 root root  4891 Apr 16 18:30 platformsh-install-20240416-183042.log
-rw-r--r-- 1 root root  4862 Apr 16 18:30 platformsh-install-20240416-183049.log
-rw-r--r-- 1 root root 14880 Apr 16 18:30 setup.deb.sh

Building a new image.

rfay commented 2 weeks ago

I was thinking about that last night, about build-essential getting into the final image. Thanks for catching that!

rfay commented 2 weeks ago

You have done so well!

image
rfay commented 2 weeks ago

There is a question remaining: If we can't downgrade for PHP8.3... should we still be downgrading for PHP8.1/2?

stasadev commented 2 weeks ago

If we can't downgrade for PHP8.3... should we still be downgrading for PHP8.1/2?

It is still supported https://www.php.net/supported-versions.php If this PR works, it could make life easier for people who have PHP8.0/1/2.

rfay commented 2 weeks ago

Oh, dear, I didn't look at the right thing, did I? That was a previous push. The current ddev-php-base is much too big:

image
rfay commented 2 weeks ago

Oh, I see you were already building as we spoke.

stasadev commented 2 weeks ago

Yes, but it failed after 30 minutes (connection timeout to php repo), I just restarted it again.

github-actions[bot] commented 2 weeks ago

Download the artifacts for this pull request:

Open in Gitpod

Open in GitHub Codespaces

stasadev commented 2 weeks ago

I ran a basic debugging session with a single breakpoint and step over, using PHP 8.0, 8.1, 8.2.

Used Linux amd64 with PhpStorm 2023.3.6.

And tested Xdebug 3.3.2 with PHP 8.3 to make sure it works the same for me.

rfay commented 2 weeks ago

So much better, thanks!:

image
stasadev commented 2 weeks ago

And this works too, so we don't limit everyone to 3.2.2:

webimage_extra_packages: ['php${DDEV_PHP_VERSION}-xdebug']