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

Add debug symbol version #879

Closed
axot opened this issue Aug 27, 2019 · 9 comments
Closed

Add debug symbol version #879

axot opened this issue Aug 27, 2019 · 9 comments
Labels
Request Request for image modification or feature

Comments

@axot
Copy link

axot commented Aug 27, 2019

It will be useful when investigating PHP segmentation. For now, we have to build a custom image for this purpose. What do you think about it?

@phy25
Copy link

phy25 commented Aug 27, 2019

Duplicate of #709, #530.

@axot
Copy link
Author

axot commented Aug 30, 2019

There are risks to enable --enable-debug, some pecl extensions may get a problem with this. My suggestion is just using -g -O2.

@wglambert wglambert added the Request Request for image modification or feature label Sep 3, 2019
@tianon
Copy link
Member

tianon commented Sep 5, 2019

Adding -g wouldn't help because we explicitly strip everything post-build:

find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \

It would be interesting/useful to add something like du -hs /usr/local before/after that line (and adding -g to PHP_CFLAGS).

@axot
Copy link
Author

axot commented Sep 8, 2019

Yes, In my local(alpine php-fpm) single php binary increased from 15M to 51M, the total size will increase 36*3 = 108M.

@HycarlDev
Copy link

can't we just remove the strip and add the -g to it?

@enumag
Copy link

enumag commented Dec 17, 2020

Hello, since the debug images from @csandanov are no longer maintained, I'd like to again ask about the possibility of having official ones.

The latest reason against it I found is this comment from @tianon about already long build times.

I fail to understand why exactly it's an issue. If you properly prioritize the tasks and have the non-debug images built and published first (since admittedly the debug images are less important), longer build time shouldn't really matter in my opinion.

So what's the problem?

@yosifkit
Copy link
Member

yosifkit commented Apr 9, 2021

If you properly prioritize the tasks and have the non-debug images built and published first (since admittedly the debug images are less important)

It is not just the php image that would be slowed down by more php images, but any other images queued to build as well.

The build system is not designed to handle special prioritizing of tags within one image repo over other tags in the same repo (or even across image repos). The only ordering of builds is dependency based (FROM). Within a single image repo (like php), tags are ordered only if there is an image dependency otherwise the order of the library/php file is the order that they are built. Builds at this level only push once all tags are built and only push to an architecture specific namespace on Docker Hub (like amd64/php and arm64v8/php).

Since each architecture builds at differing speeds, a separate job called put-shared eventually combines the tags from different architectures to create the multi-architecture manifest found at the main "library" namespace for the image (php on Docker Hub)

See https://github.com/docker-library/oi-janky-groovy for the groovy generators that create the jobs. See also our FAQ repo: https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what

@martinvonwittich
Copy link

Debug symbols would be extremely useful for the ability to attach to running PHP instances with gdb -p <pid> and to run zbacktrace as provided by PHP's php-src/.gdbinit to get a PHP stack trace. Here is an example how to use it: https://reverseengineering.stackexchange.com/questions/9558/how-to-get-current-php-function-name-in-gdb

The debug symbols don't even need to be included in the images; Debian provides their debug symbols in separate -dbgsym packages so that you can install these debug packages only when you actually need them. The build ID is used to identify the correct file that contains the debug symbols for a specific binary; the file is AFAIK generated with objcopy by the dh_strip debhelper build tool:

host ~ # file /usr/bin/php8.1 
/usr/bin/php8.1: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=31db10c6dec8cae42cfc103c4565817eacd6b1f9, for GNU/Linux 3.2.0, stripped
host ~ # ll /usr/lib/debug/.build-id/31/db10c6dec8cae42cfc103c4565817eacd6b1f9.debug 
-rw-r--r-- 2 root root 8,3M 11. Jul 10:55 /usr/lib/debug/.build-id/31/db10c6dec8cae42cfc103c4565817eacd6b1f9.debug

The build process of the PHP docker images could generate these debug files and e.g. host them on a web server, where people could download them as needed.

@tianon
Copy link
Member

tianon commented Dec 20, 2023

Closing via #1364 (which is as close as we plan to get to this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for image modification or feature
Projects
None yet
Development

No branches or pull requests

8 participants