SQLCipher on Windows and Qt

1640 views
Skip to first unread message

MoZo

unread,
May 25, 2010, 10:47:38 AM5/25/10
to SQLCipher Users
Hi all and sorry for my poor english. I'm creating an application
using SQLITE (Spatialite) on C++ Qt, and my Boss want the databa

MoZo

unread,
May 25, 2010, 10:47:39 AM5/25/10
to SQLCipher Users

MoZo

unread,
May 25, 2010, 10:53:21 AM5/25/10
to SQLCipher Users
(I'm sorry for multipost it's a mistake and i can't delete them)

Hi all and sorry for my poor english. I'm creating an application
using SQLITE (Spatialite) on C++ Qt, and my Boss want the database
have to don't be visible/read or open by something except our
application. So i search some solution on the web and I found
SQLCipher as the only free solution (?).

The only tutorial i found (on this google group) is
http://www.wiki.crossplatform.ru/index.php/%D0%9F%D1%80%D0%B8%D0%B2%D1%8F%D0%B7%D0%BA%D0%B0_SQLCipher_%D0%BA_Qt#.D0.9E.D0.B1.D1.81.D1.83.D0.B6.D0.B4.D0.B5.D0.BD.D0.B8.D0.B5

But it's written in Russia.

Plz can anyone explain me how to install SQLCipher on a windows plz ?

Thx a lot, cordialy MoZo

Stephen Lombardo

unread,
May 26, 2010, 8:58:56 AM5/26/10
to sqlc...@googlegroups.com
Hi MoZo,

Thanks for checking into SQLCipher. You are correct, SQLCipher is the only free and open source SQLite encryption plugin that I'm aware of. 

We don't yet have a specific set of build instructions for windows, but it is possible to compile it using mingw. There is some great information on various tips and tricks for windows compilation in this thread:


Also, since you are using QT, you might want to check out that tutorial via a translation. I've found it to be very readable when translated using google translate.


Please let us know if that helps point you in the right direction. Thanks!

Cheers,
Stephen

MoZo

unread,
Jun 8, 2010, 9:46:07 AM6/8/10
to SQLCipher Users
Thx Stephen lombardo and sorry for the delayed answer. I'm checking
the tutorial using Google translate.

So first i install MSYS. The installer ask me where MinWG is
installed.

I think it's in the "C:\Qt\qtcreator-1.3.0\mingw\bin" folder but
installer says that make.exe is missing but the install finish
correctly.

then I install OpenSSL and let the dll in the Windows system directory
(is that right ?)

then I install tcltk in the C:\Qt\qtcreator-1.3.0\mingw directory and
i rename the tclsh84.exe to tclsh.exe

I put the SqlCipher package at c:/sqlcipher

So I use the MSYS line command

cd c:/sqlcipher
$ ./configure --prefix=/C:/Qt/2009.05/qt/src/plugins/sqldrivers/
sqlcipher --disable-tcl --disable-amalgamation
CFLAGS="-DSQLITE_HAS_CODEC -I../OpenSSL/include /c/Windows/
System32/libeay32.dll"

work fine

$ make

work fine

$ make dll

work fine

$ make install

give me this error

$ make install
/bin/install -c -d /c:/Qt/2009.05/qt/src/plugins/sqldrivers/sqlcipher/
lib
./libtool --mode=install /bin/install -c libsqlite3.la /c:/Qt/2009.05/
qt/src/plu
gins/sqldrivers/sqlcipher/lib
libtool: install: /bin/install -c .libs/libsqlite3.lai /c:/Qt/2009.05/
qt/src/plu
gins/sqldrivers/sqlcipher/libsqlite3.la
/bin/install: cannot create regular file `/c:/Qt/2009.05/qt/src/
plugins/sqldrive
rs/sqlcipher/libsqlite3.la': No such file or directory
make: *** [lib_install] Error 1

Or the directory already exist !! Did i miss something ??

Stephen Lombardo

unread,
Jun 8, 2010, 3:24:00 PM6/8/10
to sqlc...@googlegroups.com
Hi MoZo,

It looks like everything was built correclty in the example you provided below. The final DLL should be sitting in your build directory where you ran the make commands. 

The make install error is most likely caused by including "c:" in the prefix path. You'd want to use this convention in msys:

/c/Qt/2009.05/qt/src/plugins/sqldrive

Let us know if it works when you re-run the build using that prefix. Thanks!

Cheers,
Stephen

MoZo

unread,
Jun 9, 2010, 4:14:12 AM6/9/10
to SQLCipher Users
Thx Stephen,

So i used the convention $ ./configure --prefix=/C/Qt/2009.05/qt/src/
plugins/sqldrivers/sqlcipher --disa
ble-tcl --disable-amalgamation CFLAGS="-DSQLITE_HAS_CODEC -I../OpenSSL/
include
/c/Windows/System32/libeay32.dll"

It work

$ make

make: Nothing to be done for `all'.

$ make dll

make: Nothing to be done for `dll.

$ make install work fine now

So now i've to create a new plugin for Qt right ?

thx a lot, cordialy MoZo

Stephen Lombardo

unread,
Jun 9, 2010, 9:36:38 AM6/9/10
to sqlc...@googlegroups.com
Hi MoZo,

Yes sir, it looks like you're all set. You can verify this by checking for the sqlite3.dll file in /C/Qt/2009.05/qt/src/.

Thanks!

Cheers,
Stephen

MoZo

unread,
Jun 10, 2010, 4:25:59 AM6/10/10
to SQLCipher Users
Thx again Stephen.

I'm thinking you're talking about the /C/Qt/2009.05/qt/src/plugins/
sqldrivers/sqlcipher/ directory right ?

I've got 3 folder :
bin ==> sqlite3.exe
include ==> sqlite3.h and sqlite3ext.h
lib ==> libsqlite3.a and libsqlite3.la and a folder :
pkgconfig ==> sqlite3.pc

But still no dll..

Sorry if i miss something cuz it's not easy for me.

Mathijs van Westendorp

unread,
Jun 10, 2010, 5:07:21 AM6/10/10
to sqlc...@googlegroups.com
Hey mozo,

I am also using sqlcipher with qt under windows and the way I got it to work was to replace sqlite3.c & sqlite3.h
in qt\src\3rdparty\sqlite with the ones from sqlcipher then adding SQLITE_HAS_CODEC & SQLITE_OS_WIN=1 to the project parameters and including openssl include directory & libraries (dll's). 

This was done using visual studio 2008 and generates a working sqlite driver for qt.

See http://doc.trolltech.com/4.6/sql-driver.html#qsqlite-for-sqlite-version-3-and-above for more info on compiling your own sql driver for qt.

Also don't forget to include the dll "qt\plugins\sqldrivers\qsqlite4.dll" when distributing,

Hope this is of any help

Mathijs

Stephen Lombardo

unread,
Jun 10, 2010, 8:19:37 AM6/10/10
to sqlc...@googlegroups.com
Hi MoZo,

If you look in the source directory where you built SQLCipher, do you see the sqlite3.dll file present there? I don't remember if the DLL is moved via the install make target, or if it is just present in the source directory. If the latter, you can just copy and move it
. It doesn't look like you had errors during the make dll step, so I suspect it's present there.

The advice that Mathijs has provided is also sound. While we don't use QT ourselves, we have successfully compiled in the SQLcipher amalgamation with our projects for iPhone, MacOS, a C#/.NET provider, and also for a Java JDBC lib. If you can't get the DLL you are welcome 

Finally, as an aside, we are planning to start distributing an "official" Win32 DDL and EXE for SQLCipher, since this seems to be a place where lots of folks struggle. There will be a nominal charge for the binary version download, but it may people save a lot of time. I'll keep the list up to date on developments. Let me know what you all think.

Cheer,
Stephen
Reply all
Reply to author
Forward
0 new messages