SQLite Forum

Cursor Keys broken on CLI ? (SQLite version 3.37.0 2021-11-24 21:16:32)
Login

Cursor Keys broken on CLI ? (SQLite version 3.37.0 2021-11-24 21:16:32)

(1) By anonymous on 2021-12-01 19:46:45 [link] [source]

Pressing arrow keys - e.g. cursor-up, to get at last command, is broken for me on the latest build. (In fact none of the cursor keys work).

pi@raspberrypi:~/projects/sqlite_bld $ ./sqlite3
SQLite version 3.37.0 2021-11-24 21:16:32
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> ^[[A -- I pressed arrow-up here.

Whereas the pre-installed version works fine from the same terminal.

SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .quit -- I pressed arrow-up here.

Not sure if this is a general problem - or something specific to the Raspberry Pi. I didn't do anything but run the standard 'configure' / 'make' steps here. (Although I did have an initial failed attempt - as I was missing 'tclsh' - so installed that, then removed 'sqlite3.h' (empty) and re-ran - no obvious errors that I saw after that).

Built on:

Raspberry Pi 4 (4gb) on the latest 32-bit version of "Pi OS" ('Bullseye').

pi@raspberrypi:~/projects/sqlite_bld $ uname -a
Linux raspberrypi 5.10.63-v7l+ #1488 SMP Thu Nov 18 16:15:28 GMT 2021 armv7l GNU/Linux
pi@raspberrypi:~/projects/sqlite_bld $ echo $TERM
xterm-256color
pi@raspberrypi:~/projects/sqlite_bld $ locale -a
C
C.UTF-8
en_GB.utf8
en_US.utf8
POSIX

(2) By Warren Young (wyoung) on 2021-12-01 20:56:25 in reply to 1 [source]

It means whoever built that binary didn't have the development files installed for libreadline, libedit, or similar.

This is a good reason to build your own binaries, which isn't difficult.

(3) By anonymous on 2021-12-02 08:57:12 in reply to 2 [link] [source]

Thanks for this - took your advice - and it all works now ! Great !

So checking the 'configure' output more carefully - I see this:

[..]
checking for library containing readline... no
checking for library containing tgetent... no
checking for readline in -lreadline... no
checking readline.h usability... no
checking readline.h presence... no
checking for readline.h... no
checking for /usr/include/readline.h... no
checking for /usr/include/readline/readline.h... no
checking for /usr/local/include/readline.h... no
checking for /usr/local/include/readline/readline.h... no
checking for /usr/local/readline/include/readline.h... no
checking for /usr/local/readline/include/readline/readline.h... no
checking for /usr/contrib/include/readline.h... no
checking for /usr/contrib/include/readline/readline.h... no
checking for /mingw/include/readline.h... no
checking for /mingw/include/readline/readline.h... no
[...]

So installed the missing dev files:

$ sudo apt-get install libreadline-dev

Re-running 'configure' after that:

[...]
checking for readline in -lreadline... yes
[...]

And the subsequent build of 'sqlite' allows me to use arrow-keys. Great - thanks for the info - good learning experience!