ncurses on adb shell android

ncurses on adb shell android

我正在尝试在 Android 上使用 ncurses 创建一个简约的命令行 gui。我为 ARM64 等交叉编译了 ncurses,一切似乎 运行。然而;在 adb shell 中开始测试 'hello world' ncurses 程序时,出现以下错误:

Error opening terminal: xterm-256color.

当我尝试将 TERM 设置为 xterm 或其他东西时,我得到:

Error opening terminal: xterm.

我是否需要任何特定的方法来编译 ncurses and/or 配置 Android 以允许像这样的 CLI gui 运行?

你需要一个终端数据库来 运行 诅咒应用程序。显然 none 已安装(尽管可能有一个终端数据库的位置与 TERMINFO or TERMINFO_DIRS 的编译默认值不对应)。

使用 ncurses,您可以配置和编译回退条目(在 INSTALL 源文件中讨论),如果在终端数据库中找不到终端描述,则使用这些条目:

In order to support operation of ncurses programs before the terminfo tree is accessible (that is, in single-user mode or at OS installation time) the ncurses library can be compiled to include an array of pre-fetched fallback entries.

NOTE: This must be done on a machine which has ncurses' infocmp and terminfo database installed (as well as ncurses' tic and infocmp programs). That is because the fallback sources are generated and compiled into the library before the build-tree's copy of infocmp is available.

These entries are checked by setupterm() only when the conventional fetches from the terminfo tree and the termcap fallback (if configured) have been tried and failed. Thus, the presence of a fallback will not shadow modifications to the on-disk entry for the same type, when that entry is accessible.

所以诀窍是像这样配置 ncurses:

./configure --without-database --with-fallbacks=xterm-256color,vt100 --without-xterm-new --disable-home-terminfo --with-termlib --enable-termcap --disable-database --host=arm-linux-gnue

这允许在不依赖库的情况下在内部使用回退