SQLite User Forum

Failed to build sqlite in msys2 environment
Login

Failed to build sqlite in msys2 environment

(1) By jose isaias cabrera (jicman) on 2024-11-06 18:03:31 [source]

One last environment, I promise.

So, I am trying to build sqlite3.exe using the latest check-in (5495b125) in a MSYS2 environment using a msys terminal. When I run these commands below, it ends with an error:

E608313@HOR732978I MSYS ~/b/sqlite/SQLite-5495b125
<b>$ ./configure --enable-all --prefix=/usr && make install</b>
Host System...x86_64-pc-msys
Build System...x86_64-pc-msys
C compiler... cc
C++ compiler... c++
Build C compiler...cc
Checking for stdlib.h...ok
Source dir = /home/E608313/b/sqlite/SQLite-5495b125
Build dir  = /home/E608313/b/sqlite/SQLite-5495b125
Configuring SQLite version 3.48.0
Looking for install ... /usr/bin/install
Checking for sys/types.h...ok
Checking if -D_FILE_OFFSET_BITS=64 is needed...no
Checking for int8_t...ok
Checking for int16_t...ok

[clip]

Checking for a suitable tcl...
Checking for tclsh9.0...no
Checking for tclsh8.6.../usr/bin/tclsh8.6
WARNING: /usr/bin/tclsh8.6 is unable to recommand a tclConfig.sh
WARNING: Unable to run tests because no tclConfig.sh file could be located
Using tclsh: /usr/bin/tclsh8.6
Checking for TCL to use for code generation...
Checking for dirent.h...ok
Checking for sys/time.h...ok
Checking for realpath...ok
TCL for code generation: jimsh

[clip]

cc  -g -O2  -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_THREADSAFE=1   -DNDEBUG -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -I/usr/include -I. -I/home/E608313/b/sqlite/SQLite-5495b125/src -I/home/E608313/b/sqlite/SQLite-5495b125/ext/rtree -I/home/E608313/b/sqlite/SQLite-5495b125/ext/icu  -I/home/E608313/b/sqlite/SQLite-5495b125/ext/fts3 -I/home/E608313/b/sqlite/SQLite-5495b125/ext/session  -I/home/E608313/b/sqlite/SQLite-5495b125/ext/misc  -shared -o libsqlite3.dll sqlite3.o  -Wl,-rpath,/usr/lib
/usr/bin/install libsqlite3.dll "/usr/lib"
Setting up SO symlinks...
-rwxr-xr-x 1 E608313 Domain Users 7381154 Nov  6 12:52 libsqlite3.dll
-rwxr-xr-x 1 E608313 Domain Users 7381154 Nov  6 12:52 libsqlite3.dll.3
-rwxr-xr-x 1 E608313 Domain Users 7381154 Nov  6 12:52 libsqlite3.dll.3.48.0
ar cr  libsqlite3.lib sqlite3.o
/usr/bin/install -m 0644 libsqlite3.lib "/usr/lib"
/usr/bin/install -m 0644 sqlite3.h "/home/E608313/b/sqlite/SQLite-5495b125/src/sqlite3ext.h" "/usr/include"
TCL_CONFIG_SH must be set to point to a "tclConfig.sh"
make: *** [/home/E608313/b/sqlite/SQLite-5495b125/main.mk:951: .tclenv.sh] Error 1

E608313@HOR732978I MSYS ~/b/sqlite/SQLite-5495b125

Any idea how to get this to complete...? Thanks.

(2) By Stephan Beal (stephan) on 2024-11-07 05:27:05 in reply to 1 [link] [source]

Any idea how to get this to complete...? Thanks.

It's finding a tclsh but not a tclConfig.sh, a corner case which it wasn't properly dealing with.

Please try the current trunk, which should resolve that for you.

(3) By Stephan Beal (stephan) on 2024-11-07 05:40:30 in reply to 1 [link] [source]

/usr/bin/tclsh8.6

It would also be very helpful if you would try this on that environment:

./configure --with--tclsh=/usr/bin/tclsh8.6 --enable-all --prefix=/usr && make install

(You might - not sure - need to add a .exe to that tclsh8.6)

The result should be almost identical to the current trunk, with one build-time difference. The configure output should swap:

Checking for TCL to use for code generation...
Checking for dirent.h...ok
Checking for sys/time.h...ok
Checking for realpath...ok
TCL for code generation: jimsh

With:

Checking for TCL to use for code generation...
TCL for code generation: /usr/bin/tclsh8.6

But it should otherwise build and install the same.

(4) By jose isaias cabrera (jicman) on 2024-11-07 12:29:23 in reply to 3 [link] [source]

It would also be very helpful if you would try this on that environment:

./configure --with--tclsh=/usr/bin/tclsh8.6 --enable-all --prefix=/usr && make install

(You might - not sure - need to add a .exe to that tclsh8.6)

After trying your suggestions, and still not working, I thought that I should try to find out where tclConfig.sh was. So, I did:

find / -xdev -iname '*tclConfig*'

I found that I needed tcl-devel library. So, my apologies. So, after running,

$ pacman -S tcl-devel

The original command worked. Thanks again for your time and support.

(5) By Stephan Beal (stephan) on 2024-11-07 13:26:58 in reply to 4 [link] [source]

After trying your suggestions, and still not working, I thought that I should try to find out where tclConfig.sh was. So, I did:

Was it still failing in the same way? That is: attempting to build one of the TCL-based components (which it shouldn't if it can't find tclConfig.sh)? If so, there's apparently a corner case or two to resolve there.

The ideal is that if it cannot find tclConfig.sh it simply behaves as if --disable-tcl were used.

So, my apologies. So, after running,

No apologies necessary. This is a case which will come up in the wild, and i'd much rather solve it now than after 3.48.0 goes out the door.

Thank you for the testing feedback!

(6) By jose isaias cabrera (jicman) on 2024-11-07 14:54:34 in reply to 5 [link] [source]

Was it still failing in the same way? That is: attempting to build one of the TCL-based components (which it shouldn't if it can't find tclConfig.sh)? If so, there's apparently a corner case or two to resolve there.

Yes, both options:

$ ./configure --with-tclsh=/usr/bin/tclsh8.6.exe --enable-all --prefix=/usr && make install

and

$ ./configure --with-tclsh=/usr/bin/tclsh8.6 --enable-all --prefix=/usr && make install

resulted in,

[...]
Checking for a suitable tcl...
WARNING: /usr/bin/tclsh8.6.exe is unable to recommand a tclConfig.sh
WARNING: Unable to run tests because no tclConfig.sh file could be located
Using tclsh: /usr/bin/tclsh8.6.exe
Checking for TCL to use for code generation...
TCL for code generation: /usr/bin/tclsh8.6.exe
[...]
cc  -g -O2  -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_THREADSAFE=1   -DNDEBUG -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -I/usr/include -I. -I/home/jcabrera/b/sqlite/SQLite-5495b125/src -I/home/jcabrera/b/sqlite/SQLite-5495b125/ext/rtree -I/home/jcabrera/b/sqlite/SQLite-5495b125/ext/icu  -I/home/jcabrera/b/sqlite/SQLite-5495b125/ext/fts3 -I/home/jcabrera/b/sqlite/SQLite-5495b125/ext/session  -I/home/jcabrera/b/sqlite/SQLite-5495b125/ext/misc  -shared -o libsqlite3.dll sqlite3.o  -Wl,-rpath,/usr/lib
/usr/bin/install libsqlite3.dll "/usr/lib"
Setting up SO symlinks...
-rwxr-xr-x 1 jcabrera None 7381154 Nov  7 06:56 libsqlite3.dll
-rwxr-xr-x 1 jcabrera None 7381154 Nov  7 06:56 libsqlite3.dll.3
-rwxr-xr-x 1 jcabrera None 7381154 Nov  7 06:56 libsqlite3.dll.3.48.0
ar cr  libsqlite3.lib sqlite3.o
/usr/bin/install -m 0644 libsqlite3.lib "/usr/lib"
/usr/bin/install -m 0644 sqlite3.h "/home/jcabrera/b/sqlite/SQLite-5495b125/src/sqlite3ext.h" "/usr/include"
TCL_CONFIG_SH must be set to point to a "tclConfig.sh"
make: *** [/home/jcabrera/b/sqlite/SQLite-5495b125/main.mk:951: .tclenv.sh] Error 1

But, as I said previously, there was no tclConfig.sh because, although I had installed tcl, the tcl-devel libraries had not been installed, and thus, not available. But, if that is something you can fix, then, by all means. :-)

(7) By Stephan Beal (stephan) on 2024-11-07 15:46:21 in reply to 6 [link] [source]

Yes, both options: ... resulted in...

We just checked in a significant overhaul to how all of those bits fit together. If you wouldn't mind, please try your test again (the .exe part shouldn't be needed now, by the way) and i will, in parallel, attempt to arrange for a reproducible case like yours, where --with-tclsh is used but neither --with-tcl nor --enable-tcl are.

But, as I said previously, there was no tclConfig.sh because, although I had installed tcl, the tcl-devel libraries had not been installed, and thus, not available. But, if that is something you can fix, then, by all means. :-)

Even without the -devel packages, the flags you provided should be permitted because tclsh can be used as a code generator in place of jimtcl. That combination can't build/run the TCL-based components (including the tests). How best to fit that particular case into the current feature check isn't yet clear, and it's unfortunately challenging to test because no systems in arm's reach have tclsh without also having tclConfig.sh (so some "faking" will be needed). Even so, that really should be legal so that's my next rabbit hole.

Thank you again for the continued testing and feedback!

(8.1) By jose isaias cabrera (jicman) on 2024-11-07 18:49:07 edited from 8.0 in reply to 7 [link] [source]

We just checked in a significant overhaul to how all of those bits fit together. If you wouldn't mind, please try your test again (the .exe part shouldn't be needed now, by the way)

This is a really good change. I was able to build it without the tcl-devel library:

E608313@HOR732978I MSYS ~/b/sqlite/SQLite-108863ec
$ ./configure --with-tclsh=/usr/bin/tclsh8.6 --enable-all --prefix=/usr && make install
Host System...x86_64-pc-msys
Build System...x86_64-pc-msys
C compiler... cc
C++ compiler... c++
Build C compiler...cc
Checking for stdlib.h...ok
Source dir = /home/E608313/b/sqlite/SQLite-108863ec
Build dir  = /home/E608313/b/sqlite/SQLite-108863ec
Configuring SQLite version 3.48.0
Looking for install ... /usr/bin/install
Checking for sys/types.h...ok
Checking if -D_FILE_OFFSET_BITS=64 is needed...no
[...]
Checking for a suitable tcl...
WARNING: /usr/bin/tclsh8.6 is unable to recommend a tclConfig.sh
Using tclsh: /usr/bin/tclsh8.6
WARNING: Found tclsh but no tclConfig.sh.

      WARNING: Cannot find a usable tclConfig.sh file.  Use
      --with-tcl=DIR to specify a directory where tclConfig.sh can be
      found.  SQLite does not use TCL internally, but some optional
      components require TCL, including tests and sqlite3_analyzer.

Checking for TCL to use for code generation...
TCL for code generation: /usr/bin/tclsh8.6
[...]
cc  -g -O2  -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_THREADSAFE=1   -DNDEBUG -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -I/usr/include -I. -I/home/E608313/b/sqlite/SQLite-108863ec/src -I/home/E608313/b/sqlite/SQLite-108863ec/ext/rtree -I/home/E608313/b/sqlite/SQLite-108863ec/ext/icu  -I/home/E608313/b/sqlite/SQLite-108863ec/ext/fts3 -I/home/E608313/b/sqlite/SQLite-108863ec/ext/session  -I/home/E608313/b/sqlite/SQLite-108863ec/ext/misc  -shared -o libsqlite3.dll sqlite3.o -Wl,-soname,libsqlite3.so.3 -Wl,-rpath,/usr/lib
/usr/bin/install libsqlite3.dll "/usr/lib"
Setting up SO symlinks...
-rwxr-xr-x 1 E608313 Domain Users 7407099 Nov  7 13:36 libsqlite3.dll
-rwxr-xr-x 1 E608313 Domain Users 7407099 Nov  7 13:36 libsqlite3.dll.3
-rwxr-xr-x 1 E608313 Domain Users 7407099 Nov  7 13:36 libsqlite3.dll.3.48.0
ar cr  libsqlite3.lib sqlite3.o
/usr/bin/install -m 0644 libsqlite3.lib "/usr/lib"
/usr/bin/install -m 0644 sqlite3.h "/home/E608313/b/sqlite/SQLite-108863ec/src/sqlite3ext.h" "/usr/include"
TCL support disabled, so not installing libtclsqlite3.dll
cc  -g -O2  -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_THREADSAFE=1   -DNDEBUG -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -I/usr/include -I. -I/home/E608313/b/sqlite/SQLite-108863ec/src -I/home/E608313/b/sqlite/SQLite-108863ec/ext/rtree -I/home/E608313/b/sqlite/SQLite-108863ec/ext/icu  -I/home/E608313/b/sqlite/SQLite-108863ec/ext/fts3 -I/home/E608313/b/sqlite/SQLite-108863ec/ext/session  -I/home/E608313/b/sqlite/SQLite-108863ec/ext/misc  -o sqlite3.exe \
        shell.c sqlite3.c \
         -DSQLITE_DQS=0 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_BYTECODE_VTAB -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_STRICT_SUBTYPE=1 \
        -Wl,-rpath,/usr/lib
/usr/bin/install -s sqlite3.exe "/usr/bin"
/usr/bin/install -m 0644 "/home/E608313/b/sqlite/SQLite-108863ec/sqlite3.1" "/usr/share/man/man1"

And yes, it was built correctly with Check-in 108863ec:

E608313@HOR732978I MSYS ~/b/sqlite/SQLite-108863ec
$ sqlite3
SQLite version 3.48.0 2024-11-07 17:34:53
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> 

So, this is pretty good job. Thanks. Let me know if you need any more testing.

josé

(9) By Stephan Beal (stephan) on 2024-11-07 19:03:22 in reply to 8.1 [link] [source]

I was able to build it without the tcl-devel library:

That explains why i was unable to reproduce your reported problem ;).

By the way...

You shouldn't actually need the --with-tclsh=/usr/bin/tclsh8.6 flag: in your setup it's being used for the code-generator scripts but if you leave off that flag it will use the in-tree copy of jimtcl. (Richard requested that when --with-tclsh is used, it trumps jimtcl, which allows him to test the code generators with bleeding-edge versions of TCL.)

You should only need that flag if jimtcl is failing to build on your system (which would be a different problem for us to solve).

Thank you for trying this out and helping work through the hiccups!