Skip to content

Conversation

@mstorchak
Copy link
Contributor

@mstorchak mstorchak commented Sep 21, 2025

📦 Package Details

Maintainer: none

Description:
1.
Tell configure where to find include directories for libreadline and libeditline.
In the case of cross-compilation, --readline or --editline alone is not enough, configure can't test if the corresponding include file is available:

$ grep -E  'CONFIG_SQLITE3_(LIB|READ)'  .config
CONFIG_SQLITE3_LIBEDIT=y
# CONFIG_SQLITE3_READLINE is not set
# CONFIG_SQLITE3_READLINE_NONE is not set
...
Checking for line-editing capability...
Readline support explicitly disabled with --disable-readline
Line-editing support for the sqlite3 shell: none
$ grep -E  'CONFIG_SQLITE3_(LIB|READ)'  .config
# CONFIG_SQLITE3_LIBEDIT is not set
CONFIG_SQLITE3_READLINE=y
# CONFIG_SQLITE3_READLINE_NONE is not set
...
Checking for line-editing capability...
WARNING: [sqlite-check-line-editing]:  Skipping check for readline.h because we're cross-compiling.
Line-editing support for the sqlite3 shell: none

Use linenoise as the default line editing option. This adds 12k on top of sqlite3-cli with no line editing capabilities, but doesn't add any extra dependencies like ncurses or readline/libedit.


🧪 Run Testing Details

  • OpenWrt Version: r31110+2-41aaebad98
  • OpenWrt Target/Subtarget: qualcommax/ipq807x
  • OpenWrt Device: Dynalink DL-WRX36

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

@mstorchak mstorchak marked this pull request as ready for review September 21, 2025 15:58
@mstorchak
Copy link
Contributor Author

@1715173329 , please review

@1715173329
Copy link
Member

Cc: @GeorgeSapkin

@mstorchak
Copy link
Contributor Author

Checking libs for tgetent...-lncurses
Checking libs for readline...-ledit

    NOTE: the local libedit uses <readline/readline.h> so we
    will compile with -DHAVE_READLINE=1 but will link with
    libedit.

Using editline flags: -I/openwrt/staging_dir/target-aarch64_cortex-a53_musl/usr/include -ledit -lncurses
WARNING: [sqlite-check-line-editing]:  readline-style completion disabled due to rl_completion_matches() signature mismatch
Line-editing support for the sqlite3 shell: editline

but then

/openwrt/build_dir/target-aarch64_cortex-a53_musl/sqlite-autoconf-3500400/shell.c:151:11: fatal error: readline/readline.h: No such file or directory
  151 | # include <readline/readline.h>
      |           ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:243: sqlite3] Error 1

@mstorchak mstorchak marked this pull request as ready for review September 23, 2025 15:16
@mstorchak
Copy link
Contributor Author

@1715173329 , @GeorgeSapkin , please review

@mstorchak
Copy link
Contributor Author

@1715173329 , @GeorgeSapkin , I'm kindly reminding you about this PR.
The summary of changes:

  • fix compilation with readline and libedit
  • add an option to use compiled-inlinenoise line editing library
  • make it the default choice to save ~400k compared to libedit, assuming no other packages depend on libedit, ncurses and readline.

@mstorchak
Copy link
Contributor Author

@GeorgeSapkin
Copy link
Member

I'll test this locally and report back. Before that, please squash your commits, fix typos in the commit message (linenose) and format it according to the submission guidelines (line length).

@mstorchak
Copy link
Contributor Author

@GeorgeSapkin , thank you!
Sure, I'll squash, rebase, use the initial commit message, and fix typos.
I kept the changes in separate commits to simplify the review process.

@mstorchak mstorchak force-pushed the sqlite branch 2 times, most recently from f90fa58 to 6563980 Compare September 29, 2025 14:09
Copy link
Member

@GeorgeSapkin GeorgeSapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally on snapshot with libedit and libnoise. Both seem to work. The new default is smaller and has less dependencies.

I imagine for compatibility sake this shouldn't be backported to 24.10, even though this affects the CLI only.

Copy link
Member

@GeorgeSapkin GeorgeSapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I retested all 4 CLI line-editing options locally and they all seem to work.

@mstorchak mstorchak force-pushed the sqlite branch 2 times, most recently from 2cf4727 to fce7d8f Compare October 4, 2025 21:18
@GeorgeSapkin GeorgeSapkin self-requested a review October 4, 2025 21:25
Add the linenoise line editing package.
It's a compact embedded replacement for readline and libedit.
It will be used in sqlite3-cli initially, but other packages
that support it, may follow.

Signed-off-by: Maxim Storchak <[email protected]>
Copy link
Member

@GeorgeSapkin GeorgeSapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-tested this locally with the new build-only package and it seems to work as expected.

- fix building sqlite3-cli with readline and libedit
- add linenoise line editing option. This adds 12k to the size of the
  bare sqlite3-cli, but doesn't add any extra dependencies
- make linenoise the default choice as the most space conserving but
  still convenient variant
- bump PKG_RELEASE

Signed-off-by: Maxim Storchak <[email protected]>
Copy link
Member

@GeorgeSapkin GeorgeSapkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-tested all 4 configs locally and everything still works. I think we can merge now.

@GeorgeSapkin GeorgeSapkin merged commit 9ba287e into openwrt:master Oct 7, 2025
11 of 12 checks passed
@mstorchak
Copy link
Contributor Author

@GeorgeSapkin , @1715173329 , thank you for your guidance and suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants