Skip to contentSkip to conversation

package/sqlite: fix configure options for readline/editline support

PATCH In review Scott Fan 2 participants 3 messages Feb 17, 2025

lore
Share & tools
lore

Scott Fan

author
#0 lore raw

PATCH 1/2 package/sqlite: fix configure options for readline/editline support

The autosetup script will skip checking for readline.h when cross-compiling, which will cause line-editing support for the sqlite3 shell to always be "none".

In this case, if the --editline option is provided, an error will be reported:
ERROR: Explicit --editline failed to find a matching library.

However, we can enable readline or editline support by specifying the CFLAGS and LDFLAGS values ​​instead of having it handled automatically by the autosetup configure script.

In addition, the libedit package actually depends on the ncurses package, just like the readline package. So when using the libedit package, also add the ncurses dependency.

---
Changes v1 -> v2:
- use the CFLAGS and LDFLAGS values instead of autosetup configure options
- update commit message

Changes v2 -> v3:
- add Tested-by in the commit message

---
 package/sqlite/sqlite.mk | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
package/sqlite/sqlite.mk +7 -4
index 5a8b033ce0..255ddc937b 100644
@@ -44,9 +44,12 @@ endif
 
 ifeq ($(BR2_PACKAGE_NCURSES)$(BR2_PACKAGE_READLINE),yy)
 SQLITE_DEPENDENCIES += ncurses readline
-else ifeq ($(BR2_PACKAGE_LIBEDIT),y)
-SQLITE_DEPENDENCIES += libedit
-SQLITE_CONF_OPTS += --disable-readline --editline
+SQLITE_CFLAGS  += -DHAVE_READLINE=1
+SQLITE_LDFLAGS += -lreadline -lncurses
+else ifeq ($(BR2_PACKAGE_NCURSES)$(BR2_PACKAGE_LIBEDIT),yy)
+SQLITE_DEPENDENCIES += ncurses libedit
+SQLITE_CFLAGS  += -DHAVE_EDITLINE=1
+SQLITE_LDFLAGS += -ledit -lncurses
 else
 SQLITE_CONF_OPTS += --disable-readline
 endif
@@ -59,7 +62,7 @@ ifeq ($(BR2_PACKAGE_SQLITE_ENABLE_JSON1),)
 SQLITE_CONF_OPTS += --disable-json
 endif
 
-SQLITE_CONF_ENV = CFLAGS="$(SQLITE_CFLAGS)"
+SQLITE_CONF_ENV = CFLAGS="$(SQLITE_CFLAGS)" LDFLAGS="$(SQLITE_LDFLAGS)"
 
 define SQLITE_CONFIGURE_CMDS
 	(cd $(@D); $(TARGET_CONFIGURE_OPTS) $(SQLITE_CONF_ENV) ./configure \
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#1 lore raw

PATCH 2/2 package/sqlite: fix build issue if C++ is not enabled since bump to 3.49.0

Buildroot commit [1] bumped sqlite to 3.49.0, and commit [2] fixed the package infra. But if the toolchain does not have C++ support enabled, the following error will occur.
Error: failed to find: no

The reason was CXX has been set to 'no' in the package/Makefile.in file. ifneq ($(BR2_INSTALL_LIBSTDCPP),y)
TARGET_CONFIGURE_OPTS += CXX=no
endif

Then the autosetup script will look for a required path ('no' above), and will exit with an error if not found.

To solve it, we can set CXX to 'false' instead of 'no', so that the autosetup script will skip checking for a C++ compiler.

Fixes:
https://autobuild.buildroot.org/?reason=sqlite-3.49.0

[1] https://gitlab.com/buildroot.org/buildroot/-/commit/db85638cea3414ca0293cbbb2352e5b0b63a2579
[2] https://gitlab.com/buildroot.org/buildroot/-/commit/a93680be30bc35f7d2465ef576035fb937ea1d64

---
 package/sqlite/sqlite.mk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
package/sqlite/sqlite.mk +5 -2
index 255ddc937b..8016ff1c4c 100644
@@ -65,7 +65,9 @@ endif
 SQLITE_CONF_ENV = CFLAGS="$(SQLITE_CFLAGS)" LDFLAGS="$(SQLITE_LDFLAGS)"
 
 define SQLITE_CONFIGURE_CMDS
-	(cd $(@D); $(TARGET_CONFIGURE_OPTS) $(SQLITE_CONF_ENV) ./configure \
+	(cd $(@D); $(TARGET_CONFIGURE_OPTS) \
+		$(if $(BR2_INSTALL_LIBSTDCPP),,CXX=false) \
+		$(SQLITE_CONF_ENV) ./configure \
 		--prefix=/usr \
 		--host="$(GNU_TARGET_NAME)" \
 		--build="$(GNU_HOST_NAME)" \
@@ -87,7 +89,8 @@ define SQLITE_INSTALL_TARGET_CMDS
 endef
 
 define HOST_SQLITE_CONFIGURE_CMDS
-	(cd $(@D); $(HOST_CONFIGURE_OPTS) $(SQLITE_CONF_ENV) ./configure \
+	(cd $(@D); $(HOST_CONFIGURE_OPTS) \
+		$(SQLITE_CONF_ENV) ./configure \
 		--prefix=/usr \
 		--host="$(GNU_HOST_NAME)" \
 		--build="$(GNU_HOST_NAME)" \
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Scott Fan
Quoted 10 lines · Scott Fan

The autosetup script will skip checking for readline.h when cross-compiling, which will cause line-editing support for the sqlite3 shell to always be "none".

In this case, if the --editline option is provided, an error will be reported:
ERROR: Explicit --editline failed to find a matching library.

However, we can enable readline or editline support by specifying the CFLAGS and LDFLAGS values ​​instead of having it handled automatically by the autosetup configure script.

Quoted 6 lines

In addition, the libedit package actually depends on the ncurses package, just like the readline package. So when using the libedit package, also add the ncurses dependency.

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot