Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ncurses on adb shell android

I'm trying to create a minimalistic command line gui with ncurses on Android. I cross compiled ncurses for ARM64 etc and everything seems to run. However; when starting my test 'hello world' ncurses program in adb shell, I get the following error:

Error opening terminal: xterm-256color.

when i try to set TERM to xterm or something i get:

Error opening terminal: xterm.

Is there any particular way I need to compile ncurses and/or configure Android to allow a CLI gui like this to run?

like image 870
efel Avatar asked May 19 '26 19:05

efel


2 Answers

You need a terminal database to run curses applications. Apparently none is installed (though it's possible that there is a terminal database whose location doesn't correspond to the compiled-in defaults for TERMINFO or TERMINFO_DIRS).

With ncurses, you can configure and compile-in fallback entries (discussed in the INSTALL source-file) which are used if the terminal description is not found in the terminal database:

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.

like image 132
Thomas Dickey Avatar answered May 22 '26 08:05

Thomas Dickey


So the trick was configuring ncurses like so:

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

This allowed the fallbacks to be used internally without relying on a library

like image 28
efel Avatar answered May 22 '26 09:05

efel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!