[GRASS5] nviz crash on debian with tcltk8.4

Hi,

finally getting around to looking at why NVIZ crashes on Debian/testing
when compliled with tcltk8.4. Here's the output of a gdb session, maybe
someone has ideas of where to look or what to try next.

GRASS 5.0.3 compiled with:
CFLAGS="-march=i686 -Wall -ggdb" ./configure \
  --with-tcltk-includes=/usr/include/tcl8.4 \
...

thanks,
Hamish

G:grass-5.0.3 > gdb $GISBASE/etc/nviz2.2/NVWISH2.2
GNU gdb 6.1-debian
Copyright 2004 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 "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Starting program: /usr/local/src/grass/grass-5.0.3/dist.i686-pc-linux-gnu/etc/nviz2.2/NVWISH2.2 -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 3702)]
[New Thread 32769 (LWP 3704)]
[New Thread 16386 (LWP 3705)]

---------------------------------
[NVIZ starts up ok, there's an unexplained 2 second 0% CPU "Please wait.."
pause before the main NVIZ menu pops up]

[panel menu-> surfaces-> new]
---------------------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 3702)]
0x403fab22 in pthread_mutex_lock () from /lib/libpthread.so.0

(gdb) l
34 *----------------------------------------------------------------------
35 */
36
37 int
38 main (
39 int argc, /* Number of command-line arguments. */
40 char **argv /* Values of command-line arguments. */
41 )
42 {
43 Tk_Main(argc, argv, NVIZ_AppInit);

(gdb) bt
#0 0x403fab22 in pthread_mutex_lock () from /lib/libpthread.so.0
#1 0x404f9fcd in free () from /lib/libc.so.6
#2 0x401aede0 in Tcl_GetObjResult () from /usr/lib/libtcl8.4.so.0
#3 0x40154514 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#4 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#5 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#6 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#7 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#8 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#9 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#10 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#11 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#12 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#13 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#14 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#15 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#16 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#17 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#18 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#19 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#20 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#21 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#22 0x401556b6 in Tcl_EvalObjEx () from /usr/lib/libtcl8.4.so.0
#23 0x400b73f1 in TkInvokeButton () from /usr/lib/libtk8.4.so.0
#24 0x400b65f9 in Tk_RadiobuttonObjCmd () from /usr/lib/libtk8.4.so.0
#25 0x084e37e0 in ?? ()
#26 0x40127ea0 in tkStubs () from /usr/lib/libtk8.4.so.0
#27 0x4011d086 in ?? () from /usr/lib/libtk8.4.so.0
#28 0x00000000 in ?? ()
#29 0xbfffe748 in ?? ()
#30 0xbfffe758 in ?? ()
#31 0x401a4b3f in Tcl_GetCommandFromObj () from /usr/lib/libtcl8.4.so.0
Previous frame inner to this frame (corrupt stack?)

(gdb) bt f
#0 0x403fab22 in pthread_mutex_lock () from /lib/libpthread.so.0
No symbol table info available.
#1 0x404f9fcd in free () from /lib/libc.so.6
No symbol table info available.
#2 0x401aede0 in Tcl_GetObjResult () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#3 0x40154514 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#4 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#5 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#6 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#7 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#8 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#9 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#10 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#11 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#12 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#13 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#14 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#15 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#16 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#17 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#18 0x401ad08f in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#19 0x40154484 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#20 0x4017b165 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#21 0x4017a783 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#22 0x401556b6 in Tcl_EvalObjEx () from /usr/lib/libtcl8.4.so.0
No symbol table info available.
#23 0x400b73f1 in TkInvokeButton () from /usr/lib/libtk8.4.so.0
No symbol table info available.
#24 0x400b65f9 in Tk_RadiobuttonObjCmd () from /usr/lib/libtk8.4.so.0
No symbol table info available.
#25 0x08233560 in ?? ()
No symbol table info available.
#26 0x40127ea0 in tkStubs () from /usr/lib/libtk8.4.so.0
No symbol table info available.
#27 0x4011d086 in ?? () from /usr/lib/libtk8.4.so.0
No symbol table info available.
#28 0x00000000 in ?? ()
No symbol table info available.
#29 0xbfffe748 in ?? ()
No symbol table info available.
#30 0xbfffe758 in ?? ()
No symbol table info available.
#31 0x401a4b3f in Tcl_GetCommandFromObj () from /usr/lib/libtcl8.4.so.0
No symbol table info available.

(gdb) n
Single stepping until exit from function pthread_mutex_lock,
which has no line number information.
Cannot find user-level thread for LWP 3705: generic error

-----------------------------------
[NVIZ windows disappear]
-----------------------------------

(gdb) n
Cannot find thread 16384: generic error
(gdb) q
The program is running. Exit anyway? (y or n) y
G:grass-5.0.3 >

finally getting around to looking at why NVIZ crashes on
Debian/testing when compliled with tcltk8.4. Here's the output of a
gdb session, maybe someone has ideas of where to look or what to try
next.

GRASS 5.0.3 compiled with:
CFLAGS="-march=i686 -Wall -ggdb" ./configure \
  --with-tcltk-includes=/usr/include/tcl8.4 \

Sorry, left out some info in the previous email.

The previous result was with any of the following added to the end of
XTRA_LDFLAGS in src.contrib/GMSL/NVIZ2.2/src/Gmakefile

-lpthread
-D_REENTRANT
-lpthread -D_REENTRANT

A previous version of Debian's tcltk8.4 worked with the -lpthread flag.

I just tried without any of those, and it crashes a bit earlier (never
make it to the menu). ... and recompiling with the extra flags
again makes it crashes at startup now .. shrug.

Here's the gdb session for the crash when no extra compile flags are used:
(or now with the flags as well)

G:grass-5.0.3 > gdb $GISBASE/etc/nviz2.2/NVWISH2.2
GNU gdb 6.1-debian
Copyright 2004 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 "i386-linux"...(no debugging symbols found)...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Starting program: /usr/lib/grass5/etc/nviz2.2/NVWISH2.2 -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 18566)]
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...[New Thread 32769 (LWP 18568)]
[New Thread 16386 (LWP 18569)]
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...

Version: @(#) 5.0.3 (October 2003)

Authors: Bill Brown, Terry Baker, Mark Astley, David Gerdes
        modifications: Jaro Hofierka, Bob Covill

Please cite one or more of the following references in publications
where the results of this program were used:
Brown, W.M., Astley, M., Baker, T., Mitasova, H. (1995).
GRASS as an Integrated GIS and Visualization System for
Spatio-Temporal Modeling, Proceedings of Auto Carto 12, Charlotte, N.C.

Mitasova, H., W.M. Brown, J. Hofierka, 1994, Multidimensional
dynamic cartography. Kartograficke listy, 2, p. 37-50.

Mitas L., Brown W. M., Mitasova H., 1997, Role of dynamic
cartography in simulations of landscape processes based on multi-variate
fields. Computers and Geosciences, Vol. 23, No. 4, pp. 437-446

http://www2.gis.uiuc.edu:2280/modviz/viz/nviz.html

The papers are available at
http://www2.gis.uiuc.edu:2280/modviz/
Adding panels from /usr/lib/grass5/etc/nviz2.2/scripts
Nv_(panels)
toplevel made
info widget made
panel area made
file menu made
Help menu made
disabled made
Nv_mkPanelMenu 1
Nv_mkPanelMenu 2 0
Nv_mkPanelMenu 2 1
Nv_mkPanelMenu 2 2
Nv_mkPanelMenu 2 3
Nv_mkPanelMenu 2 4

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 18566)]
0x404a93de in mallopt () from /lib/libc.so.6

(gdb) l
No symbol table is loaded. Use the "file" command.

(gdb) bt
#0 0x404a93de in mallopt () from /lib/libc.so.6
#1 0x404a8c18 in mallopt () from /lib/libc.so.6
#2 0x404a7e03 in malloc () from /lib/libc.so.6
#3 0x401b3524 in Tcl_GetMemoryInfo () from /usr/lib/libtcl8.4.so.0
#4 0x401b2b97 in TclpAlloc () from /usr/lib/libtcl8.4.so.0
#5 0x40158c45 in Tcl_Alloc () from /usr/lib/libtcl8.4.so.0
#6 0x400995b6 in TkAllocWindow () from /usr/lib/libtk8.4.so.0
#7 0x4009a046 in Tk_CreateWindowFromPath () from /usr/lib/libtk8.4.so.0
#8 0x00000000 in ?? ()
#9 0x08348840 in ?? ()
#10 0x401c5989 in TclpThreadDataKeyGet () from /usr/lib/libtcl8.4.so.0
Previous frame inner to this frame (corrupt stack?)

---------------------------
['bt f' just gives above with "No symbol table info available."]
---------------------------

(gdb) s
Single stepping until exit from function mallopt,
which has no line number information.
Cannot find user-level thread for LWP 18569: generic error

---------------------------
[NVIZ windows close]
---------------------------

(gdb) s
Cannot find thread 16384: generic error
(gdb) q
The program is running. Exit anyway? (y or n) y
Quitting: Cannot find thread 16384: generic error
G:grass-5.0.3 >

Hamish