Re: Using Qt debug libraries without configure and qmake
On 17/11/11 12:19, Simon McVittie wrote:
On Thu, 17 Nov 2011 at 13:00:40 +0100, Malte Forkel wrote:
- What do you mean by
Don't strip in the upstream build. Just don't. Ever.
Is it that any stripping should be initiated from debian/rules, but
should never be performed by the upstream Makefiles?
Always build with -g, and never discard the debug symbols entirely.
The Debian way to strip debug symbols out of the "normal" library
is usually done with dh_strip, part of debhelper:
* first, objcopy(1) the debug symbols into files that will end up installed to
/usr/lib/debug by the -dbg binary package - gdb knows how to find them
* then and only then, use strip(1) to remove the debug symbols from the
"main" version of the library
The files in /usr/lib/debug are not complete libraries: they contain
the debug symbols which were previously in the corresponding library
in /usr/bin, but they do not contain any executable code.
This means the main library package is small (because it only contains the
executable code), but can still be debugged by installing the corresponding
-dbg package (which contains the corresponding debug symbols). While
debugging your program or library, gdb reads both the main library and its
debug symbols, and behaves as if the debug symbols had been in the main
library all along.
I've been saying "library", but some packages do the same for binaries
(e.g. dbus-dbg contains /usr/lib/debug/usr/bin/dbus-daemon, which contains
the debug symbols for /usr/bin/dbus-daemon, without duplicating the
The dh_strip source code is very readable; have a look at it if you want
While useful, debug symbolsonlyhelp so much.
On some other distributions the debugging symbols package includes the source code
and kdbg integration so that kdbg can prompt you to download the dbg package while
you're debugging an app.
Even with this, optimization can make the instruction pointer appear to dart all
over the place when single stepping, and also optimizes out variables that you
would sometimes really like to know the value of.
Maybe a "noopt" package variant would help here, but that would nearly double the
number of package builds.
Wasn't there a gcc objective to tame this with release builds?
Looking at "Re: Could the multiarch wiki page be explicit about pkgconfig files?"
I've seen debugging symbols point to source files all over the place, depending
on who or how the package in question was built, none of which pointed to
/usr/lib/debug or similar.
Developers new to Debian can't fail to be surprised by this.