Skip to contentSkip to conversation

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

PATCH Superseded Scott Fan 2 participants 6 messages Feb 14, 2025 – Feb 17, 2025

lore
Share & tools
lore

Scott Fan

author
#0 lore raw

PATCH 1/1 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.

We can use the --with-readline-cflags option to tell autosetup where to search for the readline.h file to avoid the disabled behavior.

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.

In addition, there is no need to pass the --disable-readline option when the --editline option is passed.

---
 package/sqlite/sqlite.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
package/sqlite/sqlite.mk +5 -3
index 5a8b033ce0..d3b69f2a93 100644
@@ -44,9 +44,11 @@ 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_CONF_OPTS += --with-readline-cflags=-I$(STAGING_DIR)/usr/include
+else ifeq ($(BR2_PACKAGE_NCURSES)$(BR2_PACKAGE_LIBEDIT),yy)
+SQLITE_DEPENDENCIES += ncurses libedit
+SQLITE_CONF_OPTS += --with-readline-cflags=-I$(STAGING_DIR)/usr/include
+SQLITE_CONF_OPTS += --editline
 else
 SQLITE_CONF_OPTS += --disable-readline
 endif
Signature · 6 lines
2.43.0

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

PATCH v2 1/1 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

---
 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
#2 lore raw

Hi Scott,
Scott Fan wrote,

Quoted 6 lines

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.

Quoted 7 lines

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.

Somehow it does not apply cleanly with git am:
Applying: package/sqlite: fix configure options for readline/editline support
error: patch failed: package/sqlite/sqlite.mk:44
error: package/sqlite/sqlite.mk: patch does not apply Patch failed at 0001 package/sqlite: fix configure options for readline/editline support

Any idea?

best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Tested-by on v2 1/1
#3 lore raw
In reply to Scott Fan

Hi,

sorry I forgot to drop v1 of the patch.

Works now. You can add a

best regards
Waldemar

Scott Fan wrote,

Quoted 56 lines

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

---
 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 · 1 line
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

author
#5 lore raw

Hi all,

The patch has been superseded by another re-sent patch, and I added a line "Tested-by" to the commit message.

Please see the link below:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Scott Fan

Quoted 11 lines · Scott Fan

Hi Julien,

Quoted 3 lines · Waldemar Brodkorb

Works now. You can add a

Please consider it, thanks.

Scott Fan

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot