SQLite Forum

Setting TOP variable does not set tcl scripts correctly
Login
I just demonstrated (to myself), again, that my above instruction alleviates any problem such as the OP (or you as 2nd anonymous) report. On the assumption that my instruction is not sufficiently clear, here is an elaboration:

> You should not need to modify any TCL scripts. 

The demonstration runs successfully with a fresh, trunk checkout from the SQLite repository. By "fresh", I mean with all files as-is when fetched from the repo.

> Here is an invocation that will build the amalgamation then the shell, provided it is run from a cmd.exe session that has had its environment set to make MSVC CLI tools usable:

This means that one of the batch files installed along with Visual Studio in recent years, shortcut to which is labeled something like "Open Visual Studio 20xx Tools Command Prompt for targeting ..." and which resolves to running something like "...\\VC\\Auxiliary\\Build\\vcvars??.bat" in a cmd.exe session, has been run in a cmd.exe session. This leaves a number of environment variable set, such as INCLUDE, LIB, LIBPATH and PATH which makes the Microsoft Visual C/C++ command line tools (CL.exe, LINK.exe, LIB.exe, NMAKE.exe) conveniently usable. Moreover, the SQLite project makefiles for that toolset are designed with this setup presumed.

> cd \<top of SQLite source tree from sqlite.org\> <br>
 md bld <br>
 cd bld <br>

These steps create a directory to contain build products and intermediate objects that result from next step, and prepares to use it. This avoids cluttering the top-level checkout directory with a lot of extraneous stuff.

Note that "\<top of SQLite source tree from sqlite.org\>" means the full pathname of the root of the retrieved SQLite library source tree, whether obtained from a compressed archive or opened (aka "checked out") from the project Fossil repository.

A further preparation, (unmentioned earlier because the OP apparently did not still need to do it), is to arrange that the TCL shell, tclsh.exe, can be invoked from the cmd.exe session thusly:<code>
  tclsh ...
</code>where ... is a set of arguments. There are alternatives, but the simplest is to arrange that %PATH% includes the bin subdirectory of a TCL installation.

> nmake /f ..\\Makefile.msc sqlite3.c TOP=.. <br>
 nmake /f ..\\Makefile.msc sqlite3.exe TOP=..

These invocations will build (or copy) the named targets and required intermediate targets such as ./fts5.c and ./fts5.h .

If we are to further discuss "the problem with the TOP variable", it would help to confirm that the above steps are being followed precisely.