interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / doc / compile-for-unix.md

105 lines · 4774 bytes Raw Blame History Rendered
1# Notes On Compiling SQLite On All Kinds Of Unix
2
3## Executive Summary
4
5 1. Get a tarball of the canonical SQLite source tree and unpack it
6 2. Run: `./configure`
7 3. Run commands like: <ul>
8 <li> `make sqlite3.c`
9 <li> `make sqlite3`</ul>
10
11## Details
12
13Here are step-by-step instructions on how to build SQLite from
14canonical source on any modern machine that isn't Windows. These
15notes are tested (on 2024-10-11) on Ubuntu and on MacOS, but they
16are general and should work on most any modern unix platform.
17See the companion document ([](./compile-for-windows.md>)) for
18guidance on building for Windows.
19
20 1. Install a C-compiler. GCC or Clang both work fine. If you are
21 reading this document, you've probably already done that.
22
23 2. *(Optional):* Install TCL development libraries. In this note,
24 we'll do a private install in the $HOME/local directory,
25 but you can make adjustments to install TCL wherever you like.
26 This document assumes you are working with TCL version 9.0.
27 See also the [](./tcl-extension-testing.md) document that contains
28 more details on compiling Tcl for use with SQLite.
29 <ol type="a">
30 <li>Get the TCL source archive, perhaps from
31 <https://www.tcl.tk/software/tcltk/download.html>
32 or <https://sqlite.org/tmp/tcl9.0.0.tar.gz>.
33 <li>Untar the source archive. CD into the "unix/" subfolder
34 of the source tree.
35 <li>Run: &ensp; `mkdir $HOME/local`
36 <li>Run: &ensp; `./configure --prefix=$HOME/local`<br>
37 SQLite deliverable builds add: &emsp; `--static CFLAGS=-Os`
38 <li>Run: &ensp; `make install`
39 </ol>
40 <p>
41 As of 2024-10-25, TCL is not longer required for many
42 common build targets, such as "sqlite3.c" or the "sqlite3"
43 command-line tool. So you can skip this step if that is all
44 you want to build. TCL is still required to run "make test"
45 and similar, or to build the TCL extension, of course.
46
47 4. Download the SQLite source tree and unpack it. CD into the
48 toplevel directory of the source tree.
49
50 5. *(Optional):* Download Antirez's "linenoise" command-line editing
51 library to provide command-line editing in the CLI. You can find
52 a suitable copy of the linenoise sources at
53 <https://sqlite.org/linenoise.tar.gz> or at various other locations
54 on the internet. If you put the linenoise source tree in
55 a directory named $HOME/linenoise or a directory "linenoise" which
56 is a sibling of the SQLite source tree, then the SQLite ./configure
57 script will automatically find and use that source code to provide
58 command-line editing in the CLI. If you would rather use the readline
59 or editline libraries or a precompiled linenoise library, there are
60 ./configure options to accommodate that choice. The SQLite developers
61 typically use $HOME/linenoise since linenoise is small, has no
62 external dependencies, "just works", and the ./configure script
63 will pick it up and use it automatically. But you do what works
64 best for you.
65 <p>
66 You are not required to have any command-line editing support in
67 order to use SQLite. But command-line editing does make the
68 interactive experience more enjoyable.
69
70 6. Run: `./configure --enable-all --with-tclsh=$HOME/local/bin/tclsh9.0`
71
72 You do not need to use --with-tclsh if the tclsh you want to use is the
73 first one on your PATH or if you are building without TCL.
74
75 Lots of other options to ./configure are available.
76 Run `./configure --help` for further guidance.
77
78 7. Run the "`Makefile`" makefile with an appropriate target.
79 Examples:
80 <ul>
81 <li> `make sqlite3.c`
82 <li> `make sqlite3`
83 <li> `make sqldiff`
84 <li> `make sqlite3_rsync`
85 </ul>
86 <p>None of the targets above require TCL. TCL is needed
87 for the following targets:
88 <ul>
89 <li> `make tclextension-install`
90 <li> `make test`
91 <li> `make releasetest`
92 </ul>
93
94 It is not required that you run the "tclextension-install" target prior to
95 running tests. However, the tests will run more smoothly if you do.
96 The version of SQLite used for the TCL extension does *not* need to
97 correspond to the version of SQLite under test. So you can install the
98 SQLite TCL extension once, and then use it to test many different versions
99 of SQLite.
100
101
102 8. For a debugging build of the CLI, use `./configure --dev`. A debugging
103 build contains lots of extra debugging code, so it is slow and a lot
104 bigger. You probably do not want to deploy a debugging build. But if
105 you are working on the code, a debugging build works much better.