How to build debug and release sqlcipher libraries?

By “debug” build, I am referring to the binaries that have all optimizations disabled and also the debug symbols. By “release” build, I am referring to he binaries that compile/link optimizations enabled and the debug symbols stripped.

Is --enable-debug and --enable-releasemode the correct flags to build the debug and release binaries respectively?

When “–enable-releasemode” is specified all tests PASS.

My debug build configure command line looks like this:
./configure --prefix=$PWD/../build --exec-prefix=$PWD/../build --enable-debug --enable-fts5 --enable-tempstore=yes CFLAGS="-DSQLCIPHER_TEST -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -I/openssl-OpenSSL_1_1_1h/build/include" LDFLAGS="-L/openssl-OpenSSL_1_1_1h/build/lib" LIBS="-lcrypto -ltcl8.5"

But When “–enable-debug” is specified I get this test failure:
test-invalid-plaintext-header-sizes…Assertion failed: (sqlite3PcacheRefCount(pPager->pPCache)>0 || pPager->tempFile), function assert_pager_state, file sqlite3.c, line 57846.
sh: line 1: 44282 Abort trap: 6 ./testfixture test/sqlcipher.test

How do I fix the test failure in debug build?


Hello @JohnGa - thanks for getting in touch and also reporting this issue. Use of --enable-debug and --enable-releasemode is just fine. The problem here is a combination between the test called test-invalid-plaintext-header-sizes and the implementation of PRAGMA cipher_plaintext_header_size. In this case a bug in the library is setting the database Pager into an error state before it has been used, which is tripping an assert when compiled in debug mode. We will definitely fix this in the next release.

That said, this assert will only fail when setting an illegal cipher_plaintext_header_size, which would not work anyway. Thus, this issue will not present any issue any working application, even when compiled in debug mode. If you’d like to complete the rest of the tests to verify everything else is working, you can remove the test-invalid-plaintext-header-sizes test from test/sqlcipher-plaintext-header.test entirely.