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 复制到嵌入式系统(除了在极少数情况下您实际使用编译器/linker 工具集在arm64 机器上运行)。
...回应 11 月 18 日的跟进:ncurses 库中的后备支持仅在setupterm
被调用(或其调用者newterm
,initscr
)的情况下使用——参见源代码。例如,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
命令有效。这是完整的跟踪,显示了对文件访问的失败调用,最后是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
运行strings
显示clear
:
vt100|vt100-am|dec vt100 (w/advanced video)
这是 terminfo 源文件的完整行。