3 Sometimes installing the debug packages for gtk and glib isn't quite enough.
4 (For instance, if the artifacts from -O2 are driving you bonkers in gdb, you
5 might want to rebuild with -O0.)
6 Here's how to build from source and use your local version without installing it.
10 On Ubuntu, to download and build glib and gtk suitable for debugging:
12 1. If you don't have a gpg key yet, generate one with gpg --gen-key.
14 2. Create file ~/.devscripts containing DEBSIGN\_KEYID=yourkey, e.g.
15 DEBSIGN\_KEYID=CC91A262
16 (See http://www.debian.org/doc/maint-guide/ch-build.en.html
18 3. If you're on a 32 bit system, do:
23 # Workaround for "E: Build-dependencies for glib2.0 could not be satisfied"
24 # See also https://bugs.launchpad.net/ubuntu/+source/apt/+bug/245068
25 sudo apt-get install libgamin-dev
26 sudo apt-get build-dep glib2.0 gtk+2.0
30 apt-get source glib2.0 gtk+2.0
32 DEB_BUILD_OPTIONS="nostrip noopt debug" debuild
34 DEB_BUILD_OPTIONS="nostrip noopt debug" debuild
36 This should take about an hour. If it gets stuck waiting for a zombie,
37 you may have to kill its closest parent (the makefile uses subshells,
38 and bash seems to get confused). When I did this, it continued successfully.
40 At the very end, it will prompt you for the passphrase for your gpg key.
42 Then, to run an app with those libraries, do e.g.
44 export LD_LIBRARY_PATH=$HOME/mylibs/gtk+2.0-2.16.1/debian/install/shared/usr/lib:$HOME/mylibs/gtk+2.0-2.20.1/debian/install/shared/usr/lib
47 gdb ignores that variable, so in the debugger, you would have to do something like
49 set solib-search-path $HOME/mylibs/gtk+2.0-2.16.1/debian/install/shared/usr/lib:$HOME/mylibs/gtk+2.0-2.20.1/debian/install/shared/usr/lib
52 See also http://sources.redhat.com/gdb/current/onlinedocs/gdb_17.html
56 If you're on a 64 bit systems, you can do the above on a 32
57 bit system, and copy the result. Or try one of the following:
59 ### Building your own GTK
62 apt-get source glib-2.0 gtk+-2.0
64 export CFLAGS='-m32 -g'
65 export LDFLAGS=-L/usr/lib32
66 export LD_LIBRARY_PATH=/work/32/lib
67 export PKG_CONFIG_PATH=/work/32/lib/pkgconfig
70 setarch i386 ./configure --prefix=/work/32 --enable-debug=yes
73 setarch i386 ./configure --prefix=/work/32 --enable-debug=yes --without-libtiff
78 _Note: Evan tried this and didn't get any debug libs at the end._
80 Or you could try this instead:
85 sudo apt-get build-dep ia32-libs
89 apt-get source ia32-libs
91 DEB_BUILD_OPTIONS="nostrip noopt debug" debuild
94 By default, this just grabs and unpacks prebuilt libraries; see
95 ia32-libs-2.7ubuntu6/fetch-and-build which documents a BUILD
96 variable which would force actual building.
97 This would take way longer, since it builds dozens of libraries.
98 I haven't tried it yet.
102 debuild may fail with
104 gpg: [stdin]: clearsign failed: secret key not available
105 debsign: gpg error occurred! Aborting....
107 if you forget to create ~/.devscripts with the right contents.
109 The build may fail with a "FAIL: abicheck.sh" if gold is your system
110 linker. Use ld instead.