Re: I want to fix a bug in GTK and need some guidance



Hi Noam,

On 24 January 2012 10:12, Noam Yorav-Raphael <noamraph gmail com> wrote:
> Can someone guide me on how to compile GTK with debugging enabled, and
> how to compile a C program that would use the GTK I compiled, so I can
> run it under gdb and try to fix the bug?

It's pretty easy. Download the gtk sources, untar, and compile to a
local prefix. Something like:

tar xf gtk+-x.x.x
cd gtk+-x.x.x
CFLAGS=-g ./configure --prefix=/home/noam/mygtk

You'll need to have the -dev packages for the gtk stack installed so
that all the headers for all the prerequisites are available, but you
probably have those already. Once it configures cleanly try:

make
make install

Now get your build environment to see your new gtk before the system
one. You need to set PKG_CONFIG_PATH to
/home/noam/mygtk/lib/pkg-config.

Finally, compile your test program and it'll see your private gtk

gcc -g test.c `pkg-config gtk+-2.0 --cflags --libs`

You can run into trouble if the gtk you build needs a more recent
cairo / glib / pango / whatever than you have on your system. You'll
find yourself installing more and yet more libraries to get a working
gtk stack and then maintaining that pyramid of hand-built packages
becomes a terrible pain.

Use jhbuild to fix this. It's a Python program which will download,
configure and install the entire gtk stack from git for you to a
private prefix, and keep everything updated for you as well.

https://live.gnome.org/Jhbuild

It does take a little fiddling to get it working but it's probably
worth it if you want to build the very latest code. Plus since
everything is in git it'll format any bug fixes you make nicely ready
to be passed upstream.

John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]