SQLite User Forum

Issues with tcl build of 3.50.0
Login

Issues with tcl build of 3.50.0

(1) By Marius Schamschla (mschamschula) on 2025-05-29 20:22:09 [source]

Now that I have the library and base tools built for version 3.50.0, I've run into several issues with the sqlite3-tcl port:

1) --with-tclinclude no longer exists (not a problem, as the include path was correctly picked up)

2) the install-test bombs

Post-install test of package require sqlite3 3.50.0...
FAILED

I commented this out, only to find that there is

3) no install rule for the man page.

(2) By Stephan Beal (stephan) on 2025-05-29 20:38:12 in reply to 1 [link] [source]

  1. --with-tclinclude no longer exists (not a problem, as the include path was correctly picked up)

That was intentional. When porting the build, the logic for that was, IMO, unnecessarily complicated for what seemed like an unnecessary use case. --with-tcl=/tcl/install/root will do the trick (and if it doesn't, it's an exotic tcl installation!).

  1. the install-test bombs

Can you please show us the output that generates? If it's not showing anything, that's a bug - it's supposed to propagate whatever error was triggered.

  1. no install rule for the man page.

There is not. It had not occurred to me that anyone would install a man page for a tcl extension. That's now on the list of TODOs.

(4) By Marius Schamschla (mschamschula) on 2025-05-29 20:48:13 in reply to 2 [link] [source]

No, there is no other output from install-test than what I showed in my original post.

Strange, I did not have to manually install the man page for version <= 3.49.2. I added a post-destroot script to handle it for now.

(7.1) By Stephan Beal (stephan) on 2025-05-29 22:38:01 edited from 7.0 in reply to 4 [link] [source]

Strange, I did not have to manually install the man page for version <= 3.49.2.

That was a different build system and it literally never crossed my mind to set up man page install rules for a tcl extension. Lesson learned.

(3) By Stephan Beal (stephan) on 2025-05-29 20:46:28 in reply to 1 [link] [source]

Post-install test of package require sqlite3 3.50.0...

BTW: the post-install test will only fail if loading the module fails. All that test does is 'package require' using the configured tclsh. If it cannot be loaded post-install then we have perhaps selected an incorrect installation path. We take the first directory offered by Tcl's $::auto_path, which is what we've always done for the Tcl extension.

(5) By Marius Schamschla (mschamschula) on 2025-05-29 20:56:00 in reply to 3 [link] [source]

If I manually run the script in tclsh I get

% /opt/local/bin/tclsh8.6
% set c 0;
0
% if {catch {package require sqlite3 3.50.0 }} {incr c};                                             
% puts ${c}
0

Which indicates a test that should have "passed"

(6.2) By Marius Schamschla (mschamschula) on 2025-05-29 21:29:32 edited from 6.1 in reply to 3 [link] [source]

I think I've figured out the issue:

When upgrading a previous version the test will fail, as the new version is only in destroot, while the old version is installed under prefix.

Sure, enough:. When I re-run the test after re-activating sqlite3-tcl @3.49.2_0, I get the following from tchsh:

% /opt/local/bin/tclsh8.6       
% set c 0;
0
% if {catch {package require sqlite3 3.50.0 }} {incr c};
1

(8.2) By Stephan Beal (stephan) on 2025-05-29 22:37:29 edited from 8.1 in reply to 6.2 [link] [source]

When upgrading a previous version the test will fail, as the new version is only in destroot, while the old version is installed under prefix.

Do you consider installation to the $DESTDIR/$prefix to be a bug? i don't but am willing to be convinced otherwise.

Edit: okay, i see now that the post-installation check can't really work when DESTDIR is set, unless the tclsh invoked happens to be under that dir. Suggestions on how to improve that would be welcomed. e.g. removing the post-install test when DESTDIR is set?

(9) By Marius Schamschla (mschamschula) on 2025-05-30 00:14:23 in reply to 8.2 [link] [source]

No, it's not a bug. The normal MacPorts build process goes extract, patch, configure build, test, destroot, install (package) and activate.

However, running the test in the present form during the destroot phase is a bug. Tests are normally run after the build and before the destroot phase, not during the installation into the destroot directory structure.

Either way, the test would need a modified test to add the path to build directory, i.e. insert something like lappend auto_path ${teaish.dir} (see patch below)

The present test will only give the correct result after the package is packaged from destroot and then activated.

In other words, it makes no sense to run the current form of the test until the new package has replaced the old one in the install prefix (generally /opt/local for MacPorts).

A quick patch fixes this problem, even with the old version still active:

--- tea/Makefile.in.orig	2025-05-29 09:35:12
+++ tea/Makefile.in	2025-05-29 19:04:18
@@ -356,6 +356,7 @@
 install-test: install-core
 	@echo "Post-install test of package require $(tx.name.pkg) $(tx.version)..."; \
 	if echo \
+		'lappend auto_path ${teaish.dir};' \
 		'set c 0; ' \
 		'@TEAISH_POSTINST_PREREQUIRE@' \
 		'if {catch {package require $(tx.name.pkg) $(tx.version)}} {incr c};' \

(10.1) By Stephan Beal (stephan) on 2025-05-30 00:27:41 edited from 10.0 in reply to 9 [link] [source]

The present test will only give the correct result after the package is packaged from destroot and then activated.

The funny thing is that i've been using that test daily for months, on many OSes, and it "just works" :).

In other words, it makes no sense to run the current form of the test until the new package has replaced the old one in the install prefix (generally /opt/local for MacPorts).

Installation, in my experience, replaces the old one. There is no extra "activation step" in my world.

A quick patch fixes this problem, even with the old version still active:

That's not testing what needs to be tested. The post-install test is ensuring that the installed copy of the package can be loaded. That patch will load the one from the build dir (which is already tested by "make test").

i can provide a configure flag to disable the post-install test (edit: or auto-do-so if that environment can be reliably detected (how?)), but am not keen on outright removing it, as it works on every platform i've tested: a handful of Linux flavors, OpenBSD, HaikuOS, Cygwin, and Msys2.

(11) By Stephan Beal (stephan) on 2025-05-30 00:45:20 in reply to 9 [link] [source]

A quick patch fixes this problem, even with the old version still active:

Counter-proposal:

Index: teaish/Makefile.in
==================================================================
--- teaish/Makefile.in
+++ teaish/Makefile.in
@@ -372,14 +372,19 @@
 	fi
 	$(INSTALL.noexec) "@TEAISH_TM_TCL@" "$(install-core.tmdir)/$(tx.tm.tgt)"
 @endif
 install-test: install-core
 	@echo "Post-install test of [package require $(tx.name.pkg) $(tx.version)]..."; \
+	set xtra=""; \
+	if [ x != "x$(DESTDIR)" ]; then \
+		xtra='set ::auto_path [linsert $$::auto_path 0 [file normalize $(DESTDIR)$(TCLLIBDIR)/..]];'; \
+	fi; \
 	if echo \
-		'set c 0; ' \
+		'set c 0; ' $$xtra \
 		'@TEAISH_POSTINST_PREREQUIRE@' \
-		'if {[catch {package require $(tx.name.pkg) $(tx.version)}]} {incr c};' \
+		'if {[catch {package require $(tx.name.pkg) $(tx.version)} xc]} {incr c};' \
+		'if {$$c && "" ne $$xc} {puts $$xc; puts "auto_path=$$::auto_path"};' \
 		'exit $$c' \
 		| $(TCLSH) ; then \
 		echo "passed"; \
 	else \
 		echo "FAILED"; \

Demo from another tree which uses that same makefile:

[stephan@nuc:~/f/tcl/teaish/teaish/example/hello]$ ../../configure --features --prefix=$PWD/p --with-tcl=$HOME/tcl/8.6
...
[stephan@nuc:~/f/tcl/teaish/teaish/example/hello]$ make install DESTDIR=$PWD/x
...
/usr/bin/install libhello0.1.so "/home/stephan/f/tcl/teaish/teaish/example/hello/x/home/stephan/tcl/8.6/lib/tcl8.6/hello0.1"
...
Post-install test of [package require hello 0.1]...
This file was activated using the -pkgInit.tcl flag to teaish-pkginfo-set. dir=/home/stephan/f/tcl/teaish/teaish/example/hello/x/home/stephan/tcl/8.6/lib/tcl8.6/hello0.1
passed

(12) By Marius Schamschla (mschamschula) on 2025-05-30 13:52:43 in reply to 11 [link] [source]

I've checked your version of the test, It passes cleanly, even with the older version of sqlite3-tcl still active.

However, I think running the test during this phase misses the whole point: Can tcl find the package and load it once it is installed? We currently are answering: Can tcl load the package at all? (my version of the test does the same thing, just from the build directory, rather than the destroot directory).

MacPorts allows for archives of multiple version of a package to exist. The user can only activate one of them, usually the current one. It is sometimes a good thing to be able to fall back to a previous version if there are unanticipated ABI breakages.

The test really should be run as a post-activation script. That means, that this test should not be run by the Makefile, but rather by the MacPorts Portfile. However, that is also tricky, because MacPorts port uses its own version of tcl (it is signed as part of the MacPorts package, and is usually an slightly older version, currently 8.6.14, vs. 8.6.16 for the package).

(13) By Stephan Beal (stephan) on 2025-05-30 15:26:30 in reply to 12 [link] [source]

However, I think running the test during this phase misses the whole point: Can tcl find the package and load it once it is installed? We currently are answering: Can tcl load the package at all? (my version of the test does the same thing, just from the build directory, rather than the destroot directory).

The sole purpose of "make install"'s post-install check is to ease my mind during development. It does that, and there are no glaring downsides to how it does it, IMO.

The test really should be run as a post-activation script. That means, that this test should not be run by the Makefile, but rather by the MacPorts Portfile. ... However, that is also tricky...

Beyond support for long-conventional build vars like $prefix and $DESTDIR, the build process doesn't account for downstream packagers' needs, nor should it. That's all downstream voodoo to us.

Ours is "a" build process, not "the" build process. We can't possibly account for every "platformism" out there. If Package Repository X has special needs, then any related maintenance burden belongs in Package Repository X. It would be a simple matter to forego the included configure script and replace the makefile with a custom 10-20-line one which perfectly suits the packager's needs.

Just like the older TEA build, the new TEA(ish) build process is not specific to SQLite, but it's spun off as its own side-project, so any changes to the core behaviors provided by that framework (like "make install") need to be well-justified, as they can affect an arbitrary number of other tcl extensions which use that same framework.

(14) By Marius Schamschla (mschamschula) on 2025-05-30 16:27:20 in reply to 13 [link] [source]

No worries!

MacPorts automatically makes sure that the library (or any binary, for that matter) links to compatible libraries when it activates a package.. That's not quite the same thing as the original test, but should do.

So I think, I'll keep either one of the simple pre-package tests, or as is currently the case, disable the test altogether, when the next sqlite3 update comes along.