Preparatory work
- Visual Studio, other versions not validated, estimated problems are not very large
- activestate ActivePerl, for compiling OpenSSL
- Mingw, download minimum installer installation on official website
- MASM, assembly code operating environment, download and install the official website
activestate Activetcl, need to use TCLSH tool
Please install the above software beforehand, note that some software will need to add environment variable manually after installation.
- OpenSSL source code , download on the official website can
- sqlcipher Source code , download on the official website can
Installing OpenSSL
Administrator Privileges Open the VS2015 command-line window and use the cd /d XXX
command to switch to the OpenSSL directory
Execute the following command:
perl Configure VC-WIN32
nmake
nmake test
If the configuration is successful, the step outputs all tests successful
nmake install
Official installation command, 32-bit machine installed by default on C:\Program Files (x86) \openssl folder
Two library files are now generated in the installation directory:
- Dynamic Library file Libcrypto-1_1.dll (located in the./bin directory)
- Static library file Libcrypto.lib (located in the./lib directory)
Compiling Sqlcipher
- Copy the two library files generated in the previous step to the Sqlcipher home directory
- administrator rights to run the C:\mingw\msys\1.0\msys.bat batch file into the Msys shell command environment
cd /d XXX
switch to the Sqlcipher directory with commands
- To modify the sqlite3.c file, add the following code at the beginning of the file:
#define SQLITE_HAS_CODEC 1#define sqlite_enable_rtree 1#define sqlite_enable_column_metadata 1#define SQLITE_TEMP_ STORE 2
- Continue to modify the sqlite3.c file by adding the following code at the end of the file:
#include <sqlcipher/crypto.c> /*** sqlcipher addition ***/#include <sqlcipher/crypto_cc.c> /*** SQLCIPHER addition ***/#include <sqlcipher/crypto_impl.c>/*** SQLCIPHER addition ***/#include <sqlcipher/ crypto_openssl.c>/*** SQLCIPHER addition ***/#include <sqlcipher/pager.c> /*** SQLCIPHER addition ***/
- Run the following command to configure:
./configure--enable-tempstore=yes--with-crypto-lib=none--disable-tcl cflags= "-dsqlite_has_codec-dsqlite_ TEMP_store=2-dnocrypt-lcrypto-dsqlcipher_crypto_openssl-i/c/progra~2/openssl/include/d/mysoftware/ SQLCIPHER/SQLCIPHER-MASTER/LIBCrypto.dll-l/d/mysoftware/sqlcipher/sqlcipher-master/-STATIC-LIBGCC " ldflags= "Libcrypto.lib"
- Execute command:
make clean
make
, generate the executable file Sqlcipher.exe
make dll
, create a library file Sqlite3.dll
So far, the Sqlcipher source code has been compiled.
Reference articles
How to compile SQLCipher for Windows Desktop.
Compiling Sqlcipher with VS2015
I hereby thank you for quoting these two articles in writing.
WIN10 compiling Sqlcipher steps