Building

There are a number of different ways to build SQLite, depending on what you’re trying to build and where you would like it installed. If you are trying to integrate the SQLite core into a host application, the easiest way to do that is to simply copy sqlite3.c and sqlite3.h into your application’s source directory. If you’re using an IDE, the sqlite3.c file can simply be added to your application’s project file and configured with the proper search paths and build directives. If you want to build a custom version of the SQLite library or sqlite3 utility, it is also easy to do that by hand.

All of the SQLite source is written in C. It cannot be compiled by a C++ compiler. If you’re getting errors related to structure definitions, chances are you’re using a C++ compiler. Make sure you use a vanilla C compiler.

Configure

If you’re using the Unix amalgamation distribution, you can build and install SQLite using the standard configure script. After downloading the distribution, it is fairly easy to unpack, configure, and build the source:

$ tar xzf sqlite-amalgamation-3.x.x.tar.gz
$ cd sqlite-3.x.x
$ ./configure
  [...]
$ make

By default, this will build the SQLite core into both static and dynamic libraries. It will also build the sqlite3 utility. These will be built with many of the extra features (such as full text search and R*Tree support) enabled. Once this finishes, the command make install will install these files, along with the header files and sqlite3 manual page. By default, ...

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.