Search code examples
ncursesterminfoubuntu-17.10

How does ncurses search for terminal descriptions


I'm building ncurses 6.1 from source for some reasons. First I configure the sources with

./configure

and then I build it with

make

both without arguments. When I try to run tests I get the error message

Error opening terminal: xterm-256color.

on my local system (Ubuntu 17.10) and

Error opening terminal: xterm

on the build server (Jenkins Docker container).

I found out that this build is looking for terminal descriptions in /usr/share/terminfo/. There are many descriptions but no xterm-256color on my local system. On the build server the folder /usr/share/terminfo/ is empty. I found xterm-256color and xterm at /lib/terminfo. When I install ncurses with package manager (apt for Ubuntu 17.10), it works. So I assume that this package chooses the right path. I copied xterm-256color resp. xterm from /lib/terminfo to /usr/share/terminfo/ and my build works on both systems now. Why do two different paths exist and why do these two versions of ncurses choose two different paths? I need a conan package of ncurses that works out of the box without copying description files.

This could be a duplicate of: How to set custom search paths for the terminfo database when building ncurses from source


Solution

  • The answer is in the summary at the end of configure (which isn't shown in the question). But running infocmp -D will show the directories that infocmp would use when looking for descriptions.

    You can modify the behavior using the TERMINFO and TERMINFO_DIRS environment variables.

    The /lib/terminfo is Debian-specific (Ubuntu doesn't provide any changes for ncurses; they simply recompile the Debian packages: most Ubuntu bug reports for ncurses deal with their problems in doing that).

    Debian by default installs someone's notion of a minimal terminal database in that directory. Install ncurses-term to get a full terminal database.

    By the way, compiling and installing ncurses on Debian/Ubuntu/other systems with ncurses already installed runs a risk of breaking the existing libraries which are used (for example) by bash and other utilities that you probably need.