"Error opening terminal: vt100." while running a binary with ncurses on ARM

2.6k Views Asked by At

I cross-compiled ncurses for ARM. Wrote a sample application that links to it. While trying to run the binary on ARM, I am getting this error.

Error opening terminal: vt100.

Looks like I am missing some terminfo installation, but not entirely sure how to do that. Can someone please help me with that?

This is the ./configure command - ./configure --host arm64-linux-gnu --prefix=/sw/nic/third-party/ncurses-6.1/arm64/ -with-termlib --enable-termcap --with-caps --disable-database --with-fallbacks --without-xterm-new

** Configuration summary for NCURSES 6.1 20180127:

   extended funcs: yes
   xterm terminfo: xterm-old

    bin directory: /ncurses-6.1/arm64//bin
    lib directory: /ncurses-6.1/arm64//lib
include directory: /ncurses-6.1/arm64//include/ncurses
    man directory: /ncurses-6.1/arm64//share/man

** Include-directory is not in a standard location After this, I am doing make, I am packaging the following and loading it on the ARM board. ncurses-6.1/lib/* /usr/share/terminfo/*

Thanks in advance.

Regards, Sai

1

There are 1 best solutions below

8
On

The INSTALL file in the ncurses source tells what you need to know:

--disable-database                                                          
    Use only built-in data.  The ncurses libraries normally read terminfo   
    and termcap data from disk.  You can configure ncurses to have a        
    built-in database, aka "fallback" entries.  Embedded applications may   
    have no need for an external database.  Some, but not all of the        
    programs are useful in this configuration, e.g., reset and tput versus  
    infocmp and tic.  

--with-fallbacks=XXX                                                        
    Specify a list of fallback terminal descriptions which will be          
    compiled into the ncurses library.  See CONFIGURING FALLBACK ENTRIES.

The command shown in the question does not list any fallback terminal descriptions (such as vt100).

The command should list the descriptions that you want to build into the library, e.g.,

./configure command - ./configure --host arm64-linux-gnu --prefix=/sw/nic/third-party/ncurses-6.1/arm64/ -with-termlib --enable-termcap --with-caps --disable-database --with-fallbacks=vt100 --without-xterm-new

Because you disabled the database, there is no point in copying /usr/share/terminfo/*, and because this uses (the default) static library, there is no need for copying the libncursesw.a to the embedded system (except in the rare case where you actually use a compiler/linker toolset running on the arm64 machine).

...responding to the followup on November 18: the fallback support in the ncurses library is only used in the case where setupterm is called (or its callers newterm, initscr)—see source code. For instance, programs such as clear will run, but not infocmp.

In a quick check, I ran this to build a test-copy, turning on ncurses' trace feature:

#!/bin/sh
unset TERM
unset TERMINFO
unset TERMINFO_DIRS
./configure \
        --prefix=/tmp/FOO \
        --enable-termcap \
        --with-trace \
        --without-debug \
        --without-ada \
        --with-fallbacks=vt100,vt102,screen
make

and then in ./progs

#!/bin/sh
export TERM=vt100
unset TERMINFO
unset TERMINFO_DIRS
rm -f trace  
export NCURSES_TRACE=0xffff
./clear

(doing the unset's to avoid picking up my environment). The trace file does not tell where the resulting description comes from. That's done before the set_curterm call. If it were read from a file, that would show up. But the clear command works. Here's the complete trace, showing the failed calls for the file-accesses, and finally the tputs call with the expected data:

TRACING NCURSES version 6.1.20181117 (tracelevel=0xffff)
called {setupterm("vt100",0,(nil))
your terminal name is vt100
using 2048 for getstr limit
+ called {_nc_first_db
duplicate /tmp/FOO/share/terminfo
not found /users/tom/.terminfo
not found /tmp/FOO/share/terminfo
not found /etc/termcap
not found /usr/share/misc/termcap
+ return }
+ called {set_curterm(0x242a2a0)
+ return }(nil)
+ called {def_shell_mode((nil)) ->term 0x242a2a0
_nc_get_tty_mode(0): iflags: {BRKINT, IXON} cflags: {CREAD} CS8 lflags: {ISIG}
+ return }0
+ called {def_prog_mode((nil)) ->term 0x242a2a0
_nc_get_tty_mode(0): iflags: {BRKINT, IXON} cflags: {CREAD} CS8 lflags: {ISIG}  
+ return }0
+ called {baudrate((nil))
+ return }38400
screen size: terminfo lines = 24 columns = 80
SYS screen size: environment LINES = 40 COLUMNS = 80
screen size is 40x80
TABSIZE = 8
return }0
tputs( = "\e[H\e[J$<50>", 40, 0x403630) called
called {delay_output(0x7ffca32a2f50,50)
return }0
called {tigetstr((nil), E3)
return }(cancelled)
tputs((cancelled), 40, 0x403630) called

Running strings on clear shows this:

vt100|vt100-am|dec vt100 (w/advanced video)

which is the complete line from the terminfo source-file.