Am 31.10.26 um 23:24 schrieb László Böszörményi (GCS):
Hi all,
On Sat, Oct 31, 2026 at 2:37 PM Gregor Ebbing <[email protected]> wrote:
Still present in 3.53.4-2. Two additional points:
Also affects tcl9.1 (tclsh9.1 from unstable).
/usr/lib/tcltk/sqlite3/pkgIndex.tcl registers the 8.6 library for every
Tcl version. Under Tcl 9 this not only fails to load, it also hides a
working sqlite3 build elsewhere on auto_path, because 3.53.4 is usually
the higher version.
I've updated packaging [1], mostly on the work of Sergei Golovan. I
need to check how pkgIndex.tcl works. You may double check packaging
if you have time.
Regards,
Laszlo/GCS
[1] dget -x https://people.debian.org/~gcs/sqlite3_3.54.1-1.dsc
Hello,
thanks for the update. I built the binary packages with
dpkg-buildpackage -us -uc -b on Debian (tclsh8.6 8.6.18, tclsh9.0 9.0.4,
tclsh9.1 9.1.0), extracted libsqlite3-tcl and libsqlite3-0 into a local
directory and loaded them from there (auto_path, LD_LIBRARY_PATH),
without installing anything. Full log below.
What works: both libraries are installed side by side,
libsqlite3.54.1.so for 8.6 and libtcl9sqlite3.54.1.so for 9. The 9.1
build also loads in 9.0, because tclsqlite.c calls
Tcl_InitStubs(interp, "8.5-", 0).
1. pkgIndex.tcl loses $dir
The generated file:
if {[package vsatisfies [package provide Tcl] 9]} {
package ifneeded sqlite3 3.54.1 [list load [file join
libtcl9sqlite3.54.1.so] Sqlite3]
} {
package ifneeded sqlite3 3.54.1 [list load [file join
libsqlite3.54.1.so] Sqlite3]
}
package require sqlite3 fails under 8.6, 9.0 and 9.1 with "couldn't load
file". With $dir inserted by hand into both lines, all three return
3.54.1.
Cause: the echo strings in debian/rules are in double quotes. make turns
$$dir into $dir, and the shell then expands it to an empty string. Fix:
escape it in both lines:
echo " package ifneeded sqlite3 $$VER [list load [file join \$$dir
libtcl9sqlite$$VER.so] Sqlite3]" >> $$PKGINDEX ; \
echo " package ifneeded sqlite3 $$VER [list load [file join \$$dir
libsqlite$$VER.so] Sqlite3]" >> $$PKGINDEX ; \
2. dynamic-tcl-library.patch links against the installed library
The link line ends in "-lsqlite3" without -L. On my build system
(libsqlite3-dev 3.53.4-2 installed) the linker picks the installed
libsqlite3.so, not the one just built in debian/<version>/; with -L. it
picks ./libsqlite3.so (see log). Adding -L. to the link line in the
patch fixes it.
3. debian/control, minor
libsqlite3-tcl has "Depends: libtcl8.6 | libtcl9.0". The 9 build is now
made against 9.1 and is stub-linked, so there is no shlibs dependency on
libtcl. Perhaps "libtcl8.6 | libtcl9.0 | libtcl9.1".
4. A check for the generated file
3.53.4-2 created pkgIndex.tcl with pkg_mkIndex and then checked it with
grep -q 'package ifneeded sqlite3'. 3.54.1-1 writes the file with echo
and has no check left. The old grep would not catch the missing $dir
anyway. A check that does:
grep -qF '$$dir' $$PKGINDEX || \
(echo "pkgIndex.tcl lost \$$dir" && exit 1)
(make turns '$$dir' into '$dir'; the single quotes keep the shell from
expanding it.)
The analysis and this reply were prepared with the help of Claude (AI).
The build and all commands in the log were run by me on my system.
Regards,
Gregor
--- Log (Debian, as normal user, nothing installed) ---
dpkg-source -x --no-check sqlite3_3.54.1-1.dsc
cd sqlite3-3.54.1
dpkg-buildpackage -us -uc -b
cd ..
mkdir x
dpkg-deb -x libsqlite3-tcl_3.54.1-1_amd64.deb x
dpkg-deb -x libsqlite3-0_3.54.1-1_amd64.deb x
cat x/usr/lib/tcltk/x86_64-linux-gnu/sqlite3/pkgIndex.tcl
for t in tclsh8.6 tclsh9.0 tclsh9.1; do
echo 'lappend auto_path x/usr/lib/tcltk/x86_64-linux-gnu; catch
{package require sqlite3} r; puts "[info patchlevel]: $r"' |
env -u TCLLIBPATH LD_LIBRARY_PATH=x/usr/lib/x86_64-linux-gnu $t
done
8.6.18: couldn't load file "libsqlite3.54.1.so": libsqlite3.54.1.so:
cannot open shared object file: No such file or directory
9.0.4: couldn't load file "libtcl9sqlite3.54.1.so":
libtcl9sqlite3.54.1.so: cannot open shared object file: No such file or
directory
9.1.0: couldn't load file "libtcl9sqlite3.54.1.so":
libtcl9sqlite3.54.1.so: cannot open shared object file: No such file or
directory
After adding $dir to both lines of pkgIndex.tcl, the same loop gives:
8.6.18: 3.54.1
9.0.4: 3.54.1
9.1.0: 3.54.1
Linker check, in sqlite3-3.54.1/debian/9.1:
$ cc -shared -o /tmp/t.so tclsqlite.o -lsqlite3 -Wl,--trace 2>&1 |
grep sqlite3
/usr/lib/gcc/x86_64-linux-gnu/16/../../../x86_64-linux-gnu/libsqlite3.so
$ cc -shared -o /tmp/t.so tclsqlite.o -L. -lsqlite3 -Wl,--trace 2>&1
| grep sqlite3
./libsqlite3.so