How to build sqlcipher (ver 3.4.1) for windows
阿新 • • 發佈:2019-02-04
用到的工具有(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