1

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

user1912491
  • 101
  • 6

1 Answers1

2

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.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Thanks Thomas. After doing this. Is it enough if I take the ncurses/lib/*a to my ARM board? Or should I copy some other files too? Thanks. – user1912491 Nov 16 '18 at 07:24
  • The ".a" file is a static library, which you likely linked with your application already (no need for the library on the embedded system in that case). – Thomas Dickey Nov 16 '18 at 09:16
  • Thanks much Thomas. I tried with --with-fallbacks=vt100,vt102,screen. I am still seeing the error. – user1912491 Nov 18 '18 at 12:18
  • I tried with —enable-database, but in vain. Is there a way to check if the support for fallback is getting compiled-in either in the .bin or .a file, using the nm or the string command on them? I suspect that, that part is failing somehow. – user1912491 Nov 18 '18 at 19:40
  • You could run `strings` on the linked-executable, and see the name compiled-in for the fallback table. The current debug-trace doesn't **show** this detail, but I added an example to show how I verified what's there today. – Thomas Dickey Nov 18 '18 at 20:19
  • Actually $TERMINFO was unset and setting it to /usr/share/terminfo resolved it. I guess that is the solution? – user1912491 Nov 18 '18 at 21:04
  • no - if you setup the trace (--with-trace), you'll see that the program found the description in a file rather than in the fallback. I'd verify that the fallback is compiled-in properly... – Thomas Dickey Nov 18 '18 at 21:05
  • In [182]: cd progs/ /home/qgb/work/tmux-static/ncurses-6.2/progs In [183]: !make V=1 gcc ../objects/infocmp.o ../objects/dump_entry.o -L../lib -DHAVE_CONFIG_H -I../progs -I. -I../include -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DNDEBUG -O2 --param max-inline-insns-single=1200 -L../lib -lncurses -ltinfo -o infocmp ../lib/libtinfo.a(lib_setup.o): In function `_nc_setupterm': lib_setup.c:(.text+0x924): undefined reference to `_nc_fallback' collect2: error: ld returned 1 exit status Makefile:284: recipe for target 'infocmp' failed make: *** [infocmp] Error 1 – CS QGB May 19 '23 at 15:08