用到的工具有(The minimal setup you need to compile SQLCipher on windows is:)
OpenSSL, either in source or binary
forms Perl - Optional, only required if you build OpenSSL
MinGW / MSYS - required to configure SQLCipher
Tcl - required by the SQLite build system to build the amalgamation code
Visual Studio - to build your project
sqlcipher依赖openssl(我用的是openssl 1.1.0f,注意sqlcipher支持的openssl版本,在CHANGELOG.md中可以看到),
编译openssl需要安装Perl(推荐ActivePerl 5.24.1 Build 2402, 64Bit版)。
编译OpenSSL(可以参考代码包里的编译说明):
perl Configure VC-WIN32 --prefix=C:\opensslbuild32
nmake
nmake test
nmake install
配置和编译sqlcipher
------------------------
./configure --disable-tcl CFLAGS="-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -I/c/opensslbuild32/include /c/sqlcipher/libcrypto.dll -L/c/sqlcipher -static-libgcc" LDFLAGS="-lcrypto"
make clean
make sqlite3.c
make
参考链接:
https://stackoverflow.com/questions/4353037/compile-sqlite-with-sqlcipher-on-windows
OpenSSL, either in source or binary
forms Perl - Optional, only required if you build OpenSSL
MinGW / MSYS - required to configure SQLCipher
Tcl - required by the SQLite build system to build the amalgamation code
Visual Studio - to build your project
sqlcipher依赖openssl(我用的是openssl 1.1.0f,注意sqlcipher支持的openssl版本,在CHANGELOG.md中可以看到),
编译openssl需要安装Perl(推荐ActivePerl 5.24.1 Build 2402, 64Bit版)。
编译OpenSSL(可以参考代码包里的编译说明):
perl Configure VC-WIN32 --prefix=C:\opensslbuild32
nmake
nmake test
nmake install
编译完后将libcrypto-xxx.dll拷贝到sqlcipher的目录下,并将名字改为libcrypto.dll,在配置sqlcipher时会用到。
配置和编译sqlcipher
------------------------
./configure --disable-tcl CFLAGS="-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -I/c/opensslbuild32/include /c/sqlcipher/libcrypto.dll -L/c/sqlcipher -static-libgcc" LDFLAGS="-lcrypto"
make clean
make sqlite3.c
make
参考链接:
https://stackoverflow.com/questions/4353037/compile-sqlite-with-sqlcipher-on-windows
https://discuss.zetetic.net/t/declaration-error-during-sqlcipher-build-on-windows-7/1838
编译成功后,会在sqlcipher的字目录.libs下生成libsqlcipher-0.dll