v 3.47.1 problem building the TCL extension
(1) By Bob C (rchapman) on 2024-12-03 22:04:34 [source]
This problem is probably an artifact of my ignorance but up through SQLite Version 3.47 I have successfully built and installed the TCL extension for both WSL and Crostini Debian versions up to and including 12.8 using the classic configure - make - make install method.
For 3.47.1 the successfully generated tea Makefile produced
>make
. . . .
. . . .
<command-line>: error: two or more data types in declaration specifiers
./generic/tclsqlite3.c:56:15: note: in expansion of macro ‘Tcl_Size’
56 | typedef int Tcl_Size;
| ^~~~~~~~
./generic/tclsqlite3.c:56:3: warning: useless type name in empty declaration
56 | typedef int Tcl_Size;
| ^~~~~~~
make: *** [Makefile:311: tclsqlite3.o] Error 1
If there were similar reports on the Forum or solution posts I missed them so I actually read the README in the tea directory -- downloaded and extracted the source tarball for version 3.47.1 -- then tried the tea READMEs configure - make suggestion with the following result.
>./configure --with-tclsh=/usr/bin/tclsh8.6
. . . .
. . . .
checking for pread64... yes
checking for pwrite... yes
checking for pwrite64... yes
using tclsh at "/usr/bin/tclsh8.6"
tclreadline::Loop: error. error in history expansion: ![file: event not found
tclsh reported library directory "/usr/lib/x86_64-linux-gnu" does not exist
/usr/bin/tclsh8.6 recommends the tclConfig.sh at DESKTOP-3Q38QFQ SQLite-b95d11e9 % #
thname for the tclConfig.sh11e9 % # Run this TCL script to find and print the pat
DESKTOP-3Q38QFQ SQLite-b95d11e9 % # file. Used by ../configure
DESKTOP-3Q38QFQ SQLite-b95d11e9 % #
. . . .
. . . .
DESKTOP-3Q38QFQ SQLite-b95d11e9 % if {![file exists $libdir]} {
y \"$libdir\" does not exist"e9 % puts stderr "tclsh reported library directory
DESKTOP-3Q38QFQ SQLite-b95d11e9 % exit 1
I really want to use the TCL extension with SQLite 3.47.1 and would greatly apprecate any advice on where I'm screwing up or how to proceed from here. TIA
(2) By Jan Nijtmans (jan.nijtmans) on 2024-12-04 14:30:38 in reply to 1 [link] [source]
You can get a corrected tarball here:
https://sourceforge.net/projects/tcl/files/Tcl/8.6.15/
From autoconf/tea/README.txt:
This TEA builder is derived from code found at http://core.tcl-lang.org/tclconfig http://core.tcl-lang.org/sampleextension The SQLite developers do not understand how it works. It seems to work for us. It might also work for you. But we cannot promise that. If you want to use this TEA builder and it works for you, that's fine. But if you have trouble, the first thing you should do is go back to using the canonical Makefile in the SQLite source tree.
(3.1) By Bob C (rchapman) on 2024-12-04 18:13:54 edited from 3.0 in reply to 2 [link] [source]
Thanks for taking time to reply to my problem.
As stated in your reference from the SQLite autoconfig/tea/README.txt.
But if you have trouble, the first thing you should do is go back
to using the canonical Makefile in the SQLite source tree.
That's the advice I think I followed and it led to the problem I tried to describe in my original post.
I don't understand your suggestion:
You can get a corrected tarball here:
https://sourceforge.net/projects/tcl/files/Tcl/8.6.15/
Does this mean that I have to build and install Tcl 8.6.15 to build the TCL extension for SQLite 3.47.1?
(6) By Jan Nijtmans (jan.nijtmans) on 2024-12-05 12:02:13 in reply to 3.1 [link] [source]
Does this mean that I have to build and install Tcl 8.6.15 to build the TCL extension for SQLite 3.47.1?
No. If you already have an earlier Tcl 8.6.x installed, that's OK too.
The thing here is: Tcl 9.0 is available now. The autoconf build-scripts supplied by the Tcl team (TEA) is fully adapted for both Tcl 8.6 and 9.0 (and a future 8.7 too). The SQLite build environment is not updated fully yet. For example, if you use the canonical Makefile in the SQLite source tree, the shared library has the same name for Tcl 8.6 and for Tcl 9.0. You cannot install them next to each other without conflicts. As long as you only use Tcl 8.6, there should be no (further) problem. If you start using Tcl 9.0, I recommend the TEA build.
I'm sure those issues will be addressed in the SQLite build environment too, eventually.
(8.1) By Bob C (rchapman) on 2024-12-05 15:07:06 edited from 8.0 in reply to 6 [link] [source]
The SQLite build environment is not updated fully yet.
Perhaps the problems I'm having while trying to build the TEA extension from the SQLite 3.47.1 autoconfig package or from the canonical Makefile in the (3.47.1) source tree with Tcl 8.6 are a testament to that???
(4.1) By Bob C (rchapman) on 2024-12-05 01:39:22 edited from 4.0 in reply to 1 [link] [source]
Continuing the search for a solution to my problem I stumbled across the following in the SQLite 3.47.0 Release Note.
12. The TCL Interface for SQLite supports TCL9. Everything probably still works for TCL 8.5 and later, though this is not guaranteed. Users are encouraged to upgrade to TCL9.
So I thought perhaps this explains my problems compiling the TCL EXTENSION and I set out to find what Debian offered for TCL9. A Debian package search for TCL9 indicated packages were availabile for trixie (testing), sid (unstable), and experimental.
According to the Debian Releases Page there isn't a scheduled release date (as of today) for Trixie (Debian 13).
If my research is correct and if TCL9 is required for compiling the TCL Extension it seems to indicate that Debian users have the following options for using the TCL Extension:
- Stay with SQLite Versions < 40.1
- Wait for the the release of Debian Trixie
- Pray to their favorite deity for a backport of TCL9 to their distribution version. Which IMO is unlikely to happen before the Trixie release.
Sigh!!
(5) By anonymous on 2024-12-05 03:20:46 in reply to 4.1 [link] [source]
Wondering if this checkin the day after 3.47.0 was released (involving Tcl_Size and TCL9) might be a hitch in your getalong...
(7) By Jan Nijtmans (jan.nijtmans) on 2024-12-05 12:18:42 in reply to 5 [link] [source]
Yes, this should help.
It's not 100% complete yet. For example, if you have Tcl 9.0.0 installed and then try:
$ cd sqlite-autoconf-3470100/tea $ ./configure --with-tcl8 $ make .... ./generic/tclsqlite3.c:349:3: error: unknown type name 'CONST' CONST char *buf, ^ ./generic/tclsqlite3.c:1874:10: warning: 'Tcl_NRAddCallback' macro redefined [-Wmacro-redefined] # define Tcl_NRAddCallback(a,b,c,d,e,f) (void)0 ^ /Library/Frameworks/Tcl.framework/Headers/tclDecls.h:3706:9: note: previous definition is here #define Tcl_NRAddCallback ^ ./generic/tclsqlite3.c:1875:10: warning: 'Tcl_NREvalObj' macro redefined [-Wmacro-redefined] # define Tcl_NREvalObj(a,b,c) 0 ^ /Library/Frameworks/Tcl.framework/Headers/tclDecls.h:3700:9: note: previous definition is here #define Tcl_NREvalObj ^ ./generic/tclsqlite3.c:1876:10: warning: 'Tcl_NRCreateCommand' macro redefined [-Wmacro-redefined] # define Tcl_NRCreateCommand(a,b,c,d,e,f) (void)0 ^ /Library/Frameworks/Tcl.framework/Headers/tclDecls.h:3698:9: note: previous definition is here #define Tcl_NRCreateCommand
Richard already has a fix for that in his mailbox ;-)
(9) By Jan Nijtmans (jan.nijtmans) on 2024-12-05 17:26:29 in reply to 7 [link] [source]
For completeness: this patch should help with "configure --with-tcl8":
Index: src/tclsqlite.c ================================================================== --- src/tclsqlite.c +++ src/tclsqlite.c @@ -339,11 +339,11 @@ /* ** Write data to an incremental blob channel. */ static int SQLITE_TCLAPI incrblobOutput( ClientData instanceData, - CONST char *buf, + const char *buf, int toWrite, int *errorCodePtr ){ IncrblobChannel *p = (IncrblobChannel *)instanceData; sqlite3_int64 nWrite = toWrite; /* Number of bytes to write */ @@ -1839,11 +1839,11 @@ ** recursive evaluation of scripts by the db eval and db trans ** commands. Even if the headers used while compiling the extension ** are 8.6 or newer, the code still tests the Tcl version at runtime. ** This allows stubs-enabled builds to be used with older Tcl libraries. */ -#if TCL_MAJOR_VERSION>8 || (TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION>=6) +#if TCL_MAJOR_VERSION>8 || !defined(TCL_MINOR_VERSION) || TCL_MINOR_VERSION>=6 # define SQLITE_TCL_NRE 1 static int DbUseNre(void){ int major, minor; Tcl_GetVersion(&major, &minor, 0, 0); return( (major==8 && minor>=6) || major>8 );
Explanation: When using --enable-tcl8, CONST is not defined by Tcl headers (extensions still must not use any deprecated Tcl 8.x stuff), and TCL_MINOR_VERSION is not availble (Since we are in a Tcl 9 environment compiling for Tcl 8.x, but we don't know x). That's all.
Hope this helps, Jan Nijtmans