[GRASS5] Using 'vask' library

Glynn Clements glynn.clements at virgin.net
Mon Feb 11 19:07:10 EST 2002


Aleksey Naumov wrote:

> I have to compile a program that runs under grass using, among other things, 
> the 'vask' library. It compiles, but gives the following error when run:
> 
> GRASS:~ > swatgrass
> 'xterm-xfree86': unknown terminal type.
> Error opening terminal: xterm-xfree86.
> GRASS:~ >

This is generated by curses (or, more precisely, by the termcap or
terminfo functions which curses calls).

> I've determined that this message is generated when V_call() is
> called.

It's probably generated by the call to initscr() within V_init(),
although the call to system("clear") may also generate the error
(although I suspect not).

> Curiously, when I run the program in gdb, it runs ok and the screen menus are 
> displayed just fine!
> 
> I thought maybe the problem has to do with how I linked in the termcap 
> library. Programmer's manual suggests using $(VASK), because "it specifies 
> both the UNIX curses and termcap libraries as well as $(VASKLIB)" (p. 286), 
> however, $(VASK) is not set when I ran 'gmake5' on the GMakefile (see below). 

The documentation is incorrect; the correct invocation for linking
against the Vask library is "$(VASKLIB) $(CURSES)".

> So I just plugged the libraries directly:
> 	$(CC) $(LDFLAGS) -o $@ $(LIST) -ltermcap -lcurses $(LIBES)

This is probably incorrect.

Most modern curses libraries use terminfo, not termcap. Also, the
terminfo functions are typically built into the curses library rather
than being a separate library.

On GNU-based systems, it's common for both libtermcap and libncurses
(libcurses.so is normally a symlink to libncurses.so) to define
symbols such as tgetent(). However, the version in libncurses will
typically use terminfo, while the version in libcurses uses termcap.

What I suspect is happening is that terminfo has a definition for
xterm-xfree86, while termcap doesn't.

I suggest using $(CURSES); that should contain the correct switch for
the curses library (either -lcurses or -lncurses), plus any necessary
dependencies (which may include termcap/terminfo libraries, and
possibly a BSD compatibility library for gtty()).

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list