ncurses 源代码中的INSTALL 文件告诉您需要了解的内容:
--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.
问题中显示的命令未列出任何备用终端描述(例如 vt100)。
该命令应列出您要构建到库中的描述,例如,
./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
因为你禁用了数据库,所以复制/usr/share/terminfo/* 没有意义,而且因为它使用(默认)静态库,所以不需要将 libncursesw.a 复制到嵌入式系统(极少数情况除外)您实际使用的编译器/链接器工具集在 arm64 机器上运行)。
...回应 11 月 18 日的跟进:ncurses 库中的回退支持仅在调用 setupterm(或其调用者 newterm、initscr)的情况下使用——见 source code .例如,clear 之类的程序会运行,但infocmp 不会运行。
在快速检查中,我运行它来构建一个测试副本,打开 ncurses 的跟踪功能:
#!/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
然后在 ./progs 中
#!/bin/sh
export TERM=vt100
unset TERMINFO
unset TERMINFO_DIRS
rm -f trace
export NCURSES_TRACE=0xffff
./clear
(执行unset 以避免拾取我的环境)。跟踪文件不会告诉结果描述来自何处。这是在set_curterm 调用之前完成的。如果它是从文件中读取的,就会显示出来。但是 clear 命令有效。这是完整的跟踪,显示了对 file 访问的失败调用,最后是带有预期数据的 tputs 调用:
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
在clear 上运行strings 显示:
vt100|vt100-am|dec vt100 (w/advanced video)
这是 terminfo 源文件的完整行。