Re: [gtk-list] Re: Call to g_print() causes Seg Fault



> > I've never done any GTK programming before so I tried the "Hello World"
> > tutorial from developer.gnome.org.  When I compile this _basic_ program,
> >
> > it produces a "Segmentation Fault":
> >
>
> OK, strace isn't the diagnostic tool you want for this. You need to
> compile the program and libraries with the '-g' option (libraries probably
> are by default), then run the program in gdb and get a backtrace.
>
> $ gdb ./programname
> (gdb) run
> [segv]
> (gdb) bt
>
> I don't see a bug in the program, so 95% likely that your header files and
> libraries don't match, so you get binary incompatibility and breakage.
> Either that or a bug in the theme you're using or something like that.

Thanks for the gdb tip (I didn't know about it :-)  Here's a typescript of my
gdb session:

> Script started on Sat Jul 31 12:03:30 1999
> voyager:~/GTKtutorial/source$ dbs   gdb ./base1
> GNU gdb 4.17.m68k.objc.threads.hwwp.fpu.gnat
> Copyright 1998 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i486-pc-linux-gnu"...
> (gdb) run
> Starting program: /home/homer/GTKtutorial/source/./base1
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x402c1784 in   ()
> (gdb) bt
> #0  0x402c1784 in   ()
> #1  0x40187fcd in g_print ()
> #2  0x80487fb in main (argc=1, argv=0xbffffd24) at base.c:14
> #3  0x40286cdf in   ()
> (gdb) quit
> The program is running.  Exit anyway? (y or n) y
> voyager:~/GTKtutorial/source$ exit
>
> Script done on Sat Jul 31 12:04:05 1999
>
Apart from making sure all my libgtk1.2 and libglib1.2 libraries are all
version 1.2.3-0, how do I check the versions?   I did a "dpkg --listfiles
libgtk1.2" and "dpkg --listfiles libglib1.2" took note of the following files:

/usr/lib/libgdk-1.2.so.0.2.1
/usr/lib/libgdk-1.2.so.0
/usr/lib/libgtk-1.2.so.0.2.1
/usr/lib/libgtk-1.2.so.0
/usr/lib/libglib-1.2.so.0.0.3
/usr/lib/libglib-1.2.so.0
/usr/lib/libgmodule-1.2.so.0.0.3
/usr/lib/libgmodule-1.2.so.0
/usr/lib/libgthread-1.2.so.0.0.3
/usr/lib/libgthread-1.2.so.0

These all seem to be the right versions....  I edited /usr/include/gtk/gtk.h
and ../gdk.h and couldn't see any version numbers in there (or a some
randomly-selected included .h files).  I do have libgtk1.2-dev 1.2.3-0 and
libglib1.2-dev 1.2.3-0 installed, though.  I have also re-installed the .deb
packages just to make sure they were installed properly.  A "dpkg --audit"
reveals no broken dependancies...

Also, I'm not using any theme - just the default that comes with GNOME.  I
did, however, test my program with the "Gradient" GTK theme - this made no
difference.

What next?



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