How to compile SQLCipher on Win64
Requirements
- ActiveState ActiveTcl 8.5 Community Edition
- Windows (64-bit, x64)
- GitHub Desktop for Windows
- GitHub Desktop for Windows 7 or later
- Microsoft Visual Studio Community 2013 Edition Update 5
- Click the “Visual Studio 2013” option 1/2 way down the left side → “Community 2013” → ISO
- OpenSSL
- From the first link (Shining Light Productions) → Win64 OpenSSL (use latest version)
1. Install Visual Studio 2013
Install Visual Studio 2013 using the instructions here.
Only follow the instructions for that one page, not the rest of the guide it is part of.
2. Install ActiveTcl 8.5
Install ActiveTcl 8.5 using the instructions here.
3. Install OpenSSL
Install OpenSSL using the instructions here.
Only follow the instructions for that one page, not the rest of the guide it is part of.
4. Clone the SQLCipher repository
Launch GitHub Desktop, then click the + sign in the upper left corner:
Then click the “Clone” tab.
Assuming you have forked the “sqlcipher” repository already, it should be in the list. If it is not then go to https://github.com/sqlcipher/sqlcipher and Fork the repository first.
Select it, then click “Clone sqlcipher“:
Choose the C:\git_repos
directory for cloning into:
5. Edit Makefile.msc
Open the SQLCipher source code folder:
Edit the file C:\git_repos\sqlcipher\Makefile.msc
using a text editor:
Values to be changed
SQLITE3DLL
- Should be changed tosqlcipher.dll
SQLITE3LIB
- Should be changed tosqlcipher.lib
SQLITE3EXE
- Should be changed tosqlcipher.exe
SQLITE3EXEPDB
- Should be changed to/pdb:sqlciphersh.pdb
-DSQLITE_TEMP_STORE
- Change it from 1 to 2
-DSQLITE_HAS_CODEC
- Add this value to theTCC
andRCC
variables
-IC:\dev\OpenSSL-Win64\include
- Add this value toTCC
andRCC
too
/LIBPATH:C:\dev\OpenSSL-Win64\lib /LIBPATH:C:\dev\OpenSSL-Win64\lib\VC
- Add to theLTLIBPATHS
variablecapi.lib padlock.lib libcrypto.lib libssl.lib
- Add to theLTLIBS
variable- Note - These filenames are just the list of files from C:\dev\OpenSSL-Win64\lib. If you have different files in your directory, use your filenames instead.
- Do a case sensitive search-n-replace, changing
sqlite3.def
tosqlcipher.def
(you should find 6 instances)
[no screenshots done yet ]
6. Compile SQLCipher
Launch the “VS2013 x64 Native Tools Command Prompt”.
It’s accessed through the “Visual Studio Tools” item in the Win 8.1 menu structure.
Change to the C:\git_repos\sqlcipher
directory:
Then run this command to compile SQLCipher:
nmake /f Makefile.msc
It should run for about a minute or so, and you’ll see various other commands running in the command prompt window.
It should finish without error, looking something like this:
If so, the process is now complete, with SQLCipher successfully compiled. 😋
7. Compile SQLCipher into DB4S
[This step still needs to be written up properly.]
With Qt Creator, add “CONFIG+=sqlcipher” to the qmake line, like this:
If using MSVC 2013 as the IDE instead of Qt Creator, add “-Dsqlcipher=1” to the cmake command for generating the solution file. Like this:
cmake -G "Visual Studio 12 2013 Win64" -Wno-dev -Dsqlcipher=1