Source: sqlite3
Version: 3.53.2-1
Severity: important
Justification: breaks architecture cross bootstrap
Tags: patch
User: [email protected]
Usertags: ftcbfs
User: [email protected]
Usertags: rebootstrap

sqlite3 fails to cross build from source. There are several issues at
hand most of which relate to the transition from autotools to TCL-based
build system.

The configure script no longer accepts separating options and values
using spaces. An equal sign must be used. This affects the --host
option.

The build system now builds the lemon executable for the build
architecture only. I suggest modifying the upstream build system to be
able to build lemon for both architectures while only building the build
architecture one by default. The Debian packaging will build the host
one as well an install it.

debian/rules hard codes a build architecture pkg-config invocation. I
suggest using dpkg's buildtools.mk to figure out a suitable pkg-config.

Please consider applying the attached patch and also forward the
upstream patch if possible.

Helmut
diff -Nru sqlite3-3.53.2/debian/changelog sqlite3-3.53.2/debian/changelog
--- sqlite3-3.53.2/debian/changelog     2026-06-13 21:08:12.000000000 +0200
+++ sqlite3-3.53.2/debian/changelog     2026-06-24 09:57:34.000000000 +0200
@@ -1,3 +1,14 @@
+sqlite3 (3.53.2-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + The new TCL-based configure requires option values to be separated with
+      equal signs.
+    + Build a host architecture lemon.
+    + Use a host architecture pkg-config to for a host compilation step.
+
+ -- Helmut Grohne <[email protected]>  Wed, 24 Jun 2026 09:57:34 +0200
+
 sqlite3 (3.53.2-1) unstable; urgency=high
 
   * New upstream release (closes: #1139960):
diff -Nru sqlite3-3.53.2/debian/patches/cross.patch 
sqlite3-3.53.2/debian/patches/cross.patch
--- sqlite3-3.53.2/debian/patches/cross.patch   1970-01-01 01:00:00.000000000 
+0100
+++ sqlite3-3.53.2/debian/patches/cross.patch   2026-06-24 09:57:34.000000000 
+0200
@@ -0,0 +1,51 @@
+--- sqlite3-3.53.2.orig/main.mk
++++ sqlite3-3.53.2/main.mk
+@@ -1113,10 +1113,13 @@
+ 
+ # Rules to build the LEMON compiler generator
+ #
+-lemon$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
++lemon-for-build$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/lemon.c 
$(TOP)/tool/lempar.c
+       $(B.cc) -o $@ $(TOP)/tool/lemon.c
+       cp $(TOP)/tool/lempar.c .
+ 
++lemon$(T.exe):$(MAKE_SANITY_CHECK) $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
++      $(T.cc) -o $@ $(TOP)/tool/lemon.c
++
+ # Rules to build the program that generates the source-id
+ #
+ mksourceid$(B.exe): $(MAKE_SANITY_CHECK) $(TOP)/tool/mksourceid.c
+@@ -1454,9 +1457,9 @@
+ #
+ parse.h:      parse.c
+ 
+-parse.c:      $(TOP)/src/parse.y lemon$(B.exe)
++parse.c:      $(TOP)/src/parse.y lemon-for-build$(B.exe)
+       cp $(TOP)/src/parse.y .
+-      ./lemon$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y
++      ./lemon-for-build$(B.exe) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y
+ 
+ pragma.h:     $(TOP)/tool/mkpragmatab.tcl $(B.tclsh)
+       $(B.tclsh) $(TOP)/tool/mkpragmatab.tcl
+@@ -1750,10 +1753,10 @@
+    $(TOP)/ext/fts5/fts5_varint.c \
+    $(TOP)/ext/fts5/fts5_vocab.c  \
+ 
+-fts5parse.c:  $(TOP)/ext/fts5/fts5parse.y lemon$(B.exe)
++fts5parse.c:  $(TOP)/ext/fts5/fts5parse.y lemon-for-build$(B.exe)
+       cp $(TOP)/ext/fts5/fts5parse.y .
+       rm -f fts5parse.h
+-      ./lemon$(B.exe) $(OPTS) -S fts5parse.y
++      ./lemon-for-build$(B.exe) $(OPTS) -S fts5parse.y
+ 
+ fts5parse.h: fts5parse.c
+ 
+@@ -2473,7 +2476,7 @@
+       rm -f *.o *.obj *.c *.da *.bb *.bbg gmon.* *.rws sqlite3$(T.exe)
+       rm -f fts5.h keywordhash.h opcodes.h sqlite3.h sqlite3ext.h 
sqlite3session.h
+       rm -rf .libs .deps tsrc .target_source
+-      rm -f lemon$(B.exe) sqlite*.tar.gz
++      rm -f lemon-for-build$(B.exe) lemon$(T.exe) sqlite*.tar.gz
+       rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe)
+       rm -f parse.* fts5parse.*
+       rm -f $(libsqlite3.DLL) $(libsqlite3.LIB) $(libtclsqlite3.DLL) 
libsqlite3$(T.dll).a
diff -Nru sqlite3-3.53.2/debian/patches/series 
sqlite3-3.53.2/debian/patches/series
--- sqlite3-3.53.2/debian/patches/series        2026-06-13 21:08:12.000000000 
+0200
+++ sqlite3-3.53.2/debian/patches/series        2026-06-24 09:57:34.000000000 
+0200
@@ -6,3 +6,4 @@
 31-increase_SQLITE_MAX_DEFAULT_PAGE_SIZE_to_32k.patch
 #32-dynamic_link.patch
 02-use-packaged-lempar.c.patch
+cross.patch
diff -Nru sqlite3-3.53.2/debian/rules sqlite3-3.53.2/debian/rules
--- sqlite3-3.53.2/debian/rules 2026-06-13 21:08:12.000000000 +0200
+++ sqlite3-3.53.2/debian/rules 2026-06-24 09:57:34.000000000 +0200
@@ -9,6 +9,7 @@
 export LC_ALL:=C.UTF-8
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all future=+lfs
+include /usr/share/dpkg/buildtools.mk
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
@@ -29,17 +30,11 @@
   confflags += --build=$(DEB_HOST_GNU_TYPE) 
--with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6
   export CROSS_BUILDING=no
 else
-  confflags += --build=$(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) 
--with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6
+  confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) 
--with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6
   LDFLAGS += -L/usr/lib/$(DEB_HOST_MULTIARCH)
   export CROSS_BUILDING=yes
 endif
 
-ifeq ($(origin CC),default)
-  HOST_CC ?= $(DEB_HOST_GNU_TYPE)-gcc
-else
-  HOST_CC ?= $(CC)
-endif
-
 export CFLAGS += -O2 -fno-strict-aliasing \
        -DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_COLUMN_METADATA \
        -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS \
@@ -89,15 +84,13 @@
 build-stamp: configure
        dh_testdir
        $(MAKE)
+       $(MAKE) lemon
 ifeq (,$(findstring $(DEB_BUILD_ARCH_OS),kfreebsd))
        # build tools
        $(MAKE) showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
 endif
-ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
-       $(MAKE) lemon
-endif
-       cd ext/misc && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC 
-I../.. -shared csv.c -o csv.so
-       cd ext/icu  && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC 
-I../.. -I../../src -shared icu.c $(shell pkg-config --libs --cflags icu-uc 
icu-io) -o icu.so
+       cd ext/misc && $(CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC -I../.. 
-shared csv.c -o csv.so
+       cd ext/icu  && $(CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC -I../.. 
-I../../src -shared icu.c $(shell $(PKG_CONFIG) --libs --cflags icu-uc icu-io) 
-o icu.so
 
        touch $@
 

Reply via email to