# Notes On Compiling SQLite On Windows 11
Here are step-by-step instructions on how to build SQLite from
-canonical source on a new Windows 11 PC, as of 2023-11-01:
+canonical source on a new Windows 11 PC, as of 2024-10-09:
1. Install Microsoft Visual Studio. The free "community edition"
will work fine. Do a standard install for C++ development.
install the TCL development libraries in the "`c:\Tcl`" directory.
Make adjustments
if you want TCL installed somewhere else. SQLite needs both the
- "tclsh.exe" command-line tool as part of the build process, and
- the "tcl86.lib" library in order to run tests. You will need
- TCL version 8.6 or later.
+ "tclsh90.exe" command-line tool as part of the build process, and
+ the "tcl90.lib" and "tclstub.lib" libraries in order to run tests.
+ This document assumes you are working with <b>TCL version 9.0</b>.
+ See versions of this document from prior to 2024-10-10 for
+ instructions on how to build using TCL version 8.6.
<ol type="a">
<li>Get the TCL source archive, perhaps from
[https://www.tcl.tk/software/tcltk/download.html](https://www.tcl.tk/software/tcltk/download.html).
of the source tree.
<li>Run: `nmake /f makefile.vc release`
<li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl install`
- <li>CD to `c:\Tcl\lib`. In that subfolder make a copy of the
- "`tcl86t.lib`" file to the alternative name "`tcl86.lib`"
- (omitting the second 't'). Leave the copy in the same directory
- as the original.
- <li>CD to `c:\Tcl\bin`. Make a copy of the "`tclsh86t.exe`"
- file into "`tclsh.exe`" (without the "86t") in the same directory.
- <li>Add `c:\Tcl\bin` to your %PATH%. To do this, go to Settings
+ <li><i>Optional:</i> CD to `c:\Tcl\bin` and make a copy of
+ `tclsh90.exe` over into just `tclsh.exe`.
+ <li><i>Optional:</i>
+ Add `c:\Tcl\bin` to your %PATH%. To do this, go to Settings
and search for "path". Select "edit environment variables for
your account" and modify your default PATH accordingly.
You will need to close and reopen your command prompts after
<li> `nmake /f makefile.msc sqlite3.c`
<li> `nmake /f makefile.msc sqlite3.exe`
<li> `nmake /f makefile.msc sqldiff.exe`
+ <li> `nmake /f makefile.msc sqlite3-rsync.exe`
<li> `nmake /f makefile.msc tclextension-install`
<li> `nmake /f makefile.msc devtest`
<li> `nmake /f makefile.msc releasetest`
~~~~
And you will end up with a working executable. However, that executable
-will depend on having the "tcl86.dll" library somewhere on your %PATH%.
+will depend on having the "tcl98.dll" library somewhere on your %PATH%.
Use the following steps to build an executable that has the TCL library
statically linked so that it does not depend on separate DLL:
2. Untar the TCL source tarball into a fresh directory. CD into
the "win/" subfolder.
- 3. Run: `nmake /f makefile.vc OPTS=nothreads,static shell`
-
+ 3. Run: `nmake /f makefile.vc OPTS=static shell`
4. CD into the "Release*" subfolder that is created (note the
wildcard - the full name of the directory might vary). There
- you will find the "tcl86s.lib" file. Copy this file into the
- same directory that you put the "tcl86.lib" on your initial
+ you will find the "tcl90s.lib" file. Copy this file into the
+ same directory that you put the "tcl90.lib" on your initial
installation. (In this document, that directory is
"`C:\Tcl32\lib`" for 32-bit builds and
"`C:\Tcl\lib`" for 64-bit builds.)
utility program, but add the following extra arguments to the
nmake command line:
<blockquote><pre>
- CCOPTS="-DSTATIC_BUILD" LIBTCL="tcl86s.lib netapi32.lib user32.lib"
+ CCOPTS="-DSTATIC_BUILD" LIBTCL="tcl90s.lib"
</pre></blockquote>
<p>So, for example, to build a statically linked version of
sqlite3_analyzer.exe, you might type:
<blockquote><pre>
- nmake /f Makefile.msc CCOPTS="-DSTATIC_BUILD" LIBTCL="tcl86s.lib netapi32.lib user32.lib" sqlite3_analyzer.exe
+ nmake /f Makefile.msc CCOPTS="-DSTATIC_BUILD" LIBTCL="tcl90s.lib" sqlite3_analyzer.exe
</pre></blockquote>
6. After your executable is built, you can verify that it does not
-C Improvements\sto\sMakefile.msc:\s(1)\sAttempt\sto\sfind\ssane\svalues\sfor\skey\nvariables\sbased\son\sthe\svalue\sof\sTCLDIR.\s\s(2)\sDefault\sto\sTCLVERSION\s90\sinstead\nof\s86.\s\s(3)\sAdd\sthe\s"tcl-env"\starget\sthat\sshows\sthe\svalues\sof\skey\svariables\nassociated\swith\sTCL.
-D 2024-10-09T20:05:26.424
+C Adjustments\sto\sthe\sMakefile.msc\sto\sget\sstatic\sbuilds\sof\ssqlite3_analyzer.exe\nworking\swith\sTCL9.\s\sUpdate\sthe\scompile-for-windows.md\sdocument\sfor\sTCL9.
+D 2024-10-10T09:59:06.503
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F Makefile.in e504a9f003b2de41447b81296d9a6988a67ffabc34fa396b60ffd89b0c63a7bf
F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6
-F Makefile.msc c6abbbe25cef6bf1eb255884cd9137b6afa4f850f4bdc78ba718f4035c35000b
+F Makefile.msc 34801b42a51a9c3cb2c98fb83e3e3a08c1a304b73e7a1ef30846fe6848c1ffd7
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
F VERSION 0db40f92c04378404eb45bff93e9e42c148c7e54fd3da99469ed21e22411f5a6
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F configure.ac aca8ebf47b7644c473e11e599ea986eeb23860a8732a8812039ad961ef52a713
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
-F doc/compile-for-windows.md 4d4bfafda42a7a33f166d23aed4db1bb4ea1e5751595a5cced2bad349fd14652
+F doc/compile-for-windows.md 8402957e1ba3ddae2d37cb44fab7fca7e099b3f2fcf33bced3a16188a00b955e
F doc/json-enhancements.md e356fc834781f1f1aa22ee300027a270b2c960122468499bf347bb123ce1ea4f
F doc/jsonb.md 5fab4b8613aa9153fbeb6259297bd4697988af8b3d23900deba588fa7841456b
F doc/lemon.html 8b266ff711d2ec7f867c3dca37634963f48a630329908cc282beebfa8c708706
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P e8f719d13fbcbaf1b52b421d7af59759b1b4692d4010a68d5865dfeaf3cf8cb0
-R 6adacab87cffb89c84a1bbdbcff4792d
+P 6b7a789a416fb62a532882d10e41c7048a6805f5fbbc008f36f9802be45d9ebb
+R c9f14e0cb6269b0c33c6b11339c3cd13
U drh
-Z f45d0adbf7e7e6e176374a9b7492aa02
+Z 3a6d1e8e76a2ebf4de7346b7f2c5b6fe
# Remove this line to create a well-formed Fossil manifest.