This introduction assumes that you have already downloaded SQLCipher to your computer.
Basic instructions for building from source are available in the README. Building SQLCipher is almost the same as compiling a regular version of SQLite with a few additional requirements. You must:
SQLITE_HAS_CODEC
SQLITE_TEMP_STORE=2
or SQLITE_TEMP_STORE=3
(or use configure
’s –with-tempstore=yes option)SQLITE_EXTRA_INIT=sqlcipher_extra_init
and SQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown
SQLITE_THREADSAFE
to 1
or 2
(enabled automatically by configure
)HAVE_STDINT_H
(if building outside of the ./configure
flow and unit64_t
is not available without stdint.h
)The following examples demonstrate use of OpenSSL, which is a readily available provider on most Unix-like systems. Note that, in this example, --with-tempstore=yes
is setting SQLITE_TEMP_STORE=2
for the build, and SQLITE_THREADSAFE
has a default value of 1
.
$ ./configure --with-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_EXTRA_INIT=sqlcipher_extra_init -DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown" LDFLAGS="-lcrypto"
$ make
While SQLCipher Community Edition is free for use, this process can be both difficult and time consuming, so we make a variety of pre-built Commercial Editional packages available for sale.