ncursesterminfo

ncurses test programs failing with message "Error opening terminal: xterm"


(Note: this is similar to this question, but the answer there does not apply.)

Running under FreeBSD, I have ncurses installed via the usual pkg method for FreeBSD, but because I've seen some odd behaviour with a previously working curses program, I decided to download an ncurses source tarball from the official site and compile it under my home directory.

The compile went fine, but attempting to run any of the included test programs results in:

 Error opening terminal: xterm.

The documentation does say:

NOTE: You must have installed the terminfo database, or set the environment variable $TERMINFO to point to a SVr4-compatible terminfo database before running the test programs. Not all vendors' terminfo databases are SVr4-compatible, but most seem to be.

So it looks like the answer is to set TERMINFO, but to what? I don't see any terminfo database under the build directory itself, but I do have a file /usr/local/share/misc/terminfo.db installed as a result of the regular FreeBSD installation.

Nevertheless, setting (csh syntax) setenv TERMINFO /usr/local/share/misc/terminfo.db (or the same omitting the .db extension) doesn't make any difference.

(Note: this shouldn't matter because I haven't so far attempted to install the local build, but when I ran "configure", I used: ./configure --prefix=$HOME so that it would install under my home directory.


Solution

  • By default, ncurses uses (reads/writes) a directory-tree of terminal descriptions. Optionally (and seen in the makefile for the ncurses port), it reads/writes a hashed database file, as well as reads the directory-tree.

    The INSTALL file in the ncurses sources goes into some detail about the --with-hashed-db configure option, which you apparently overlooked. The term(5) manual page gives a better overview.