【问题标题】:"Error opening terminal: vt100." while running a binary with ncurses on ARM“打开终端时出错:vt100。”在 ARM 上运行带有 ncurses 的二进制文件时
【发布时间】:2018-11-15 12:57:51
【问题描述】:

我为 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/*

提前致谢。

问候, 赛

【问题讨论】:

    标签: cross-compiling ncurses xterm vt100


    【解决方案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 复制到嵌入式系统(极少数情况除外)您实际使用的编译器/链接器工具集在 arm64 机器上运行)。

    ...回应 11 月 18 日的跟进:ncurses 库中的回退支持仅在调用 setupterm(或其调用者 newterminitscr)的情况下使用——见 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 源文件的完整行。

    【讨论】:

    • 谢谢托马斯。这样做之后。如果我将 ncurses/lib/*a 带到我的 ARM 板上就足够了吗?还是我也应该复制一些其他文件?谢谢。
    • “.a”文件是一个静态库,您可能已经将它与您的应用程序链接(在这种情况下,嵌入式系统上不需要该库)。
    • 非常感谢托马斯。我试过 --with-fallbacks=vt100,vt102,screen。我仍然看到错误。
    • 我尝试使用--enable-database,但没有成功。有没有办法使用 nm 或 string 命令检查是否在 .bin 或 .a 文件中编译了对回退的支持?我怀疑,那部分以某种方式失败了。
    • 您可以在链接的可执行文件上运行strings,并查看后备表的编译名称。当前的调试跟踪没有显示这个细节,但我添加了一个示例来展示我如何验证今天的内容。
    猜你喜欢
    • 2017-08-11
    • 2017-02-07
    • 2012-07-08
    • 1970-01-01
    • 2013-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多