[pacman-dev] [PATCH] makepkg: Only change debug prefix if making debug package

Austin Lund austin.lund at gmail.com
Tue Jul 30 11:34:19 UTC 2019

On Tue, 30 Jul 2019 at 15:33, Eli Schwartz <eschwartz at archlinux.org> wrote:
> > The current prefix rewriting to /usr/src/debug
> > essentially ensures a symbol lookup failure when compiling with debug
> > enabled for these packages (unless you build in /usr/src/debug).  The
> > gcc substitute path can only handle one FROM path hence you cannot
> > simultaneously get symbols for these packages.
> Good point.
> > Would a relative path for the debug !strip case make more sense?  In
> > that instance gdb could be configured using "set directories" to
> > resolve to the build sources should they not be purged.

> I guess if we're going to make this behavior conditional at all, simply
> disabling it entirely as your initial patch does would be the simplest
> approach and also works OOTB for the debugging case (assuming the build
> directory is still extant).

I had a play around with some of the options.  The way gdb handles the
lookup of sources and symbols is somewhat strange.  The only way I
have managed to get it to work without having a reference to the
original build directory is to change the prefix to something that is
easily searchable and be substituted on a per-source-tree basis.
Unlike the recommendation in the gcc manual page, this is _not_ "." as
you can't point different trees to different directories.  For the
"debug" and "!strip" case, I used:

DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=arch-${pkgname}"

That seemed to work OK as I could add a set subsitiute-path into the
build sources for each package which was "debug" and "!strip".

More information about the pacman-dev mailing list