0

我为 ARM 交叉编译了 ncurses。编写了一个链接到它的示例应用程序。尝试在 ARM 上运行二进制文件时,出现此错误。

打开终端时出错:vt100。

看起来我缺少一些 terminfo 安装,但不完全确定如何做到这一点。有人可以帮我吗?

这是 ./configure 命令 - ./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

** 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

** 包含目录不在标准位置之后,我正在制作,我正在打包以下内容并将其加载到 ARM 板上。ncurses-6.1/lib/* /usr/share/terminfo/*

提前致谢。

问候, 赛

4

1 回答 1

1

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被调用(或其调用者newterminitscr)的情况下使用——参见源代码。例如,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 源文件的完整行。

于 2018-11-15T21:23:34.213 回答