Debuginfo doesn't seem to work
I saw @TheRealMichaelCatanzaro complaining (https://blogs.gnome.org/mcatanzaro/2018/05/27/thoughts-on-flatpak-after-four-months-of-epiphany-technology-preview/) about debuginfo not working in the 1.8 based gnome sdk.
So, I updated to the latest release, and it very much doesn't work:
$ flatpak run org.freedesktop.Sdk//unstable sh
bwrap: Can't mkdir /usr/lib/x86_64-linux-gnu/debug: Read-only file system
error: ldconfig failed, exit status 256
This is because the sdk has:
[Extension org.freedesktop.Sdk.Debug]
directory = lib/x86_64-linux-gnu/debug
But the mount-path lib/x86_64-linux-gnu/debug
doesn't exist in the sdk. However, didn't we decide to use a single /usr/lib/debug
mountpoint for the debug stuff? If so, this should directory=lib/debug
, which does exist in the sdk.
However, your lib/debug lacks a app -> /app/lib/debug
symlink, which means that applications can't ship their own debuginfo. You need to add this both to the regular Sdk (used when no runtime debuginfo is installed) and in the Sdk.Debug (used when installed).
The way things work is that /usr/lib/debug is configured as the gdk "debug prefix", and whenever you load a path, say /app/bin/foo
, or /usr/lib/x86_64-linux-gnu/libfoo.so
it will prepend this and look for debuginfo there (/usr/lib/debug/app/bin/foo
, /usr/lib/debug/usr/lib/x86_64-linux-gnu/libfoo.so
).
Also, in flatpak-builder we also put the sources in the debug extension, as /usr/lib/debug/source/$module
. We then build each runtime module with CWD /run/build-runtime/$module
, and flatpak always creates these links in the sandbox:
sh-4.3$ ls -l /run/
lrwxrwxrwx 1 alex wheel 21 maj 28 09:19 build -> /app/lib/debug/source
lrwxrwxrwx 1 alex wheel 21 maj 28 09:19 build-runtime -> /usr/lib/debug/source
This means the source paths encoded in the debuginfo will always resolve at runtime if you have the debug extension installed.
Additionally, building with a fixed CWD means we create (more) host-independent debuginfo and thus more reproducible results.