[GRASS5] [bug #1561] (grass) tcl command error in tcltkgrass startup

David D Gray ddgray at armadce.demon.co.uk
Sat Feb 1 13:26:35 EST 2003

Glynn Clements wrote:

>>Attempting to start Tcltkgrass:
>>GRASS:/arc/ddgray/cvs/main/grass > tcltkgrass&
>>[1] 16133
>>GRASS:/arc/ddgray/cvs/main/grass > bad switch "-dictionary": must be -ascii, -integer, -real, -increasing -decreasing, or -command
>>    while executing
>>"lsort -dictionary [split [read $fd] \n]"
>>    invoked from within
>>"foreach line [lsort -dictionary [split [read $fd] \n]]..."
>>    (procedure "set_list" line 25)
>>    invoked from within
>>"set_list etc ellipse.table 1 "\ \t""
>>    invoked from within
>>"set spheroids [set_list etc ellipse.table 1 "\ \t"]..."
>>    (file "/opt/grass5/tcltkgrass/main/gui.tcl" line 1776)
>>    invoked from within
>>"source $env(TCLTKGRASSBASE)/main/gui.tcl"
>>    invoked from within
>>"if [catch {source $env(TCLTKGRASSBASE)/main/gui.tcl}] {
>>    set env(TCLTKGRASSBASE) $env(GISBASE)/tcltkgrass
>>    source $env(TCLTKGRASSBASE)/main/gui. ..."
>>    (file "/opt/grass5/bin/tcltkgrass" line 26)
>>All home directory rc files had been cleared.
>>Problem occurred with 3 separate Tcl/Tk installations, most recent 8.3.3
>>(Mandrake 9.0)
>>I can't think of anything local that might be causing this. But I'm not
>>a Tcl expert.
> It appears that the -dictionary switch was added in Tcl 8.0. It is a
> case-insensitive version of -ascii.

That helps to clarify the difficulty. It indicates that the problem is 
version skew between the version that is used at compile-time, and the 
Tcl/Tk binaries picked up at runtime. In fact I found that at startup 
the script was attempting to run a version 7.6/4.2 installation.

> [...]
> For the developers: do we just change -dictionary to -ascii, or should
> we try to use -dictionary if it is available (e.g. using "catch" to
> fall-back to -ascii)?

If the -dictionary switch was added with version 8.0, then it is 
probably worth retaining, for as I understand, tcltkgrass requires 
version 8.0+, and there are probably other issues apart from this 
switch, so not much point attempting to support previous versions.

But, is it generally Ok to put some environment variables in Init.sh or 
the tcltkgrass startup that uses the Tcl/Tk base set at compile time? 
Then the correct paths for wish and the libs could be set. I found that 
setting these manually got round the problem by putting the following in 

# Tcl/Tk base

export TCLTKBASE=/usr  # Configure should set this. Does it already?
export TCLTKLIB=$TCLTKBASE/lib  # But maybe wish calls the right libs 
export GRASS_TCLSH=$TCLTKBASE/bin/tclsh
export GRASS_WISH=$TCLTKBASE/bin/wish

if [ ! "$LD_LIBRARY_PATH" ] ; then
   LD_LIBRARY_PATH=$TCLTKLIB:$LD_LIBRARY_PATH # export later; searching 
/usr first might cause problems for some?


More information about the grass-dev mailing list