1 # Notes On Compiling SQLite On Windows 11
3 Here are step-by-step instructions on how to build SQLite from
4 canonical source on a new Windows 11 PC, as of 2023-08-16:
6 1. Install Microsoft Visual Studio. The free "community edition"
7 will work fine. Do a standard install for C++ development.
9 "cl" compiler and the "nmake" build tool.
11 2. Under the "Start" menu, find "All Apps" then go to "Visual Studio 20XX"
12 and find "x64 Native Tools Command Prompt for VS 20XX". Pin that
13 application to your task bar, as you will use it a lot. Bring up
14 an instance of this command prompt and do all of the subsequent steps
15 in that "x64 Native Tools" command prompt. (Or use "x86" if you want
16 a 32-bit build.) The subsequent steps will not work in a vanilla
17 DOS prompt. Nor will they work in PowerShell.
19 3. Install TCL development libraries. This note assumes that you wil
20 install the TCL development libraries in the "`c:\Tcl`" directory.
22 if you want TCL installed somewhere else. SQLite needs both the
23 "tclsh.exe" command-line tool as part of the build process, and
24 the "tcl86.lib" library in order to run tests. You will need
25 TCL version 8.6 or later.
27 <li>Get the TCL source archive, perhaps from
28 [https://www.tcl.tk/software/tcltk/download.html](https://www.tcl.tk/software/tcltk/download.html).
29 <li>Untar or unzip the source archive. CD into the "win/" subfolder
31 <li>Run: `nmake /f makefile.vc release`
32 <li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl install`
33 <li>CD to `c:\Tcl\lib`. In that subfolder make a copy of the
34 "`tcl86t.lib`" file to the alternative name "`tcl86.lib`"
35 (omitting the second 't'). Leave the copy in the same directory
37 <li>CD to `c:\Tcl\bin`. Make a copy of the "`tclsh86t.exe`"
38 file into "`tclsh.exe`" (without the "86t") in the same directory.
39 <li>Add `c:\Tcl\bin` to your %PATH%. To do this, go to Settings
40 and search for "path". Select "edit environment variables for
41 your account" and modify your default PATH accordingly.
42 You will need to close and reopen your command prompts after
46 4. Download the SQLite source tree and unpack it. CD into the
47 toplevel directory of the source tree.
49 5. Set the TCLDIR environment variable to point to your TCL installation.
52 <li> `set TCLDIR=c:\Tcl`
55 6. Run the "`Makefile.msc`" makefile with an appropriate target.
58 <li> `nmake /f makefile.msc`
59 <li> `nmake /f makefile.msc sqlite3.c`
60 <li> `nmake /f makefile.msc devtest`
61 <li> `nmake /f makefile.msc releasetest`
66 Doing a 32-bit build is just like doing a 64-bit build with the
67 following minor changes:
69 1. Use the "x86 Native Tools Command Prompt" instead of
70 "x64 Native Tools Command Prompt". "**x86**" instead of "**x64**".
72 2. Use a different installation directory for TCL.
73 The recommended directory is `c:\tcl32`. Thus you end up
76 <li> `c:\tcl` ← 64-bit (the default)
77 <li> `c:\tcl32` ← 32-bit
80 3. Ensure that `c:\tcl32\bin` comes before `c:\tcl\bin` on
81 your PATH environment variable. You can achieve this using
84 <li> `set PATH=c:\tcl32\bin;%PATH%`