Compile wxSQLite with encryption and linkingSQLite3.dll sta Topic is solved
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Compile wxSQLite with encryption and linkingSQLite3.dll sta
I can do the DLL version of SQLite3 and have wxSQLite3 as static. I want to compile all things as static so I don't know what include folders and .cpp I need to include. Note *encryption* support.
Thanks
Thanks
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
Download the SQLite amalgamation source code from the SQLite download site and copy the sources into subdirectory sqlite3/secure/src/codec-c. Then create a project for compiling SQLite as a static library using your favorite IDE. Add file sqlite3secure.c as the only source file to your project. This file includes all other required source files.evstevemd wrote:I can do the DLL version of SQLite3 and have wxSQLite3 as static. I want to compile all things as static so I don't know what include folders and .cpp I need to include. Note *encryption* support.
You need to specify several preprocessor symbols to get a valid SQLite library.
The following 2 symbols enable encryption support:
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
In the latter symbol you may specify CODEC_TYPE_AES256 instead of CODEC_TYPE_AES128 to enable the (experimental) support for AES 256 bit encryption.
The following 2 symbols are usually always required resp. recommended:
SQLITE_CORE
THREADSAFE=1
The following 3 symbols are optional to enable specific SQLite features:
SQLITE_SECURE_DELETE
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
The following 3 symbols enable optional extension modules:
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
On Windows, copy the resulting static library file sqlite3.lib to subdirectory sqlite3/lib and create wxSQLite3 as usual.
For other platforms the required steps might vary slightly.
Regards,
Ulrich
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
I'm confused as to where I put those macros. Do I put them in sqlite3secure.c? and if yes, do I put something like this?utelle wrote:Download the SQLite amalgamation source code from the SQLite download site and copy the sources into subdirectory sqlite3/secure/src/codec-c. Then create a project for compiling SQLite as a static library using your favorite IDE. Add file sqlite3secure.c as the only source file to your project. This file includes all other required source files.evstevemd wrote:I can do the DLL version of SQLite3 and have wxSQLite3 as static. I want to compile all things as static so I don't know what include folders and .cpp I need to include. Note *encryption* support.
You need to specify several preprocessor symbols to get a valid SQLite library.
The following 2 symbols enable encryption support:
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
In the latter symbol you may specify CODEC_TYPE_AES256 instead of CODEC_TYPE_AES128 to enable the (experimental) support for AES 256 bit encryption.
The following 2 symbols are usually always required resp. recommended:
SQLITE_CORE
THREADSAFE=1
The following 3 symbols are optional to enable specific SQLite features:
SQLITE_SECURE_DELETE
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
The following 3 symbols enable optional extension modules:
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
On Windows, copy the resulting static library file sqlite3.lib to subdirectory sqlite3/lib and create wxSQLite3 as usual.
For other platforms the required steps might vary slightly.
Regards,
Ulrich
Code: Select all
#ifndef SQLITE_HAS_CODEC
#define
#ifndef CODEC_TYPE=CODEC_TYPE_AES128
#define CODEC_TYPE=CODEC_TYPE_AES128
#endif
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
Those preprocessor symbols have to appear on the compiler's command line. Usually each IDE has a compiler options dialog somewhere, where you can specify preprocessor symbols.evstevemd wrote:I'm confused as to where I put those macros. Do I put them in sqlite3secure.c? and if yes, do I put something like this?Code: Select all
#ifndef SQLITE_HAS_CODEC #define #ifndef CODEC_TYPE=CODEC_TYPE_AES128 #define CODEC_TYPE=CODEC_TYPE_AES128 #endif
Alternatively you could place #define statements right at the beginning of sqlite3secure.c, but I wouldn't recommend to do so.
Regards,
Ulrich
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
I use CodeLite and Hope Eran will help on this. I will dig to see what I can do.utelle wrote:Those preprocessor symbols have to appear on the compiler's command line. Usually each IDE has a compiler options dialog somewhere, where you can specify preprocessor symbols.evstevemd wrote:I'm confused as to where I put those macros. Do I put them in sqlite3secure.c? and if yes, do I put something like this?Code: Select all
#ifndef SQLITE_HAS_CODEC #define #ifndef CODEC_TYPE=CODEC_TYPE_AES128 #define CODEC_TYPE=CODEC_TYPE_AES128 #endif
Alternatively you could place #define statements right at the beginning of sqlite3secure.c, but I wouldn't recommend to do so.
Regards,
Ulrich
Thanks Urlich for your usual support on wxSQLite
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
I decided to add for codeliters.
Right click project then go to properties. Click compiler tab and look for preprocessor. You can type in the Macros separating with semicolon or click button and get the dialog where each preprocessor goes in new line
Hope others will do it!
Right click project then go to properties. Click compiler tab and look for preprocessor. You can type in the Macros separating with semicolon or click button and get the dialog where each preprocessor goes in new line
Hope others will do it!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Hi,
I try to use below settings and I tried without defining them and I got library file and works. When I the preprocessors below I get errors quoted below!
Here are preprocessor directives
SQLITE_CORE
THREADSAFE=1
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
SQLITE_SECURE_DELETE
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
here are errors:
I try to use below settings and I tried without defining them and I got library file and works. When I the preprocessors below I get errors quoted below!
Here are preprocessor directives
SQLITE_CORE
THREADSAFE=1
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
SQLITE_SECURE_DELETE
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
here are errors:
In file included from C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/sqlite3secure.c:50:
C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/codecext.c: In function 'sqlite3_rekey':
C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/codecext.c:250: error: void value not ignored as it ought to be
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
If you try to compile the latest SQLite version 3.7.2 you have to get the latest version of codecext.c first from the wxCode SVN. There were changes in the internal SQLite pager interface.evstevemd wrote:I try to use below settings and I tried without defining them and I got library file and works. When I the preprocessors below I get errors quoted below!
Here are preprocessor directives
SQLITE_CORE
THREADSAFE=1
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
SQLITE_SECURE_DELETE
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
here are errors:
In file included from C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/sqlite3secure.c:50:
C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/codecext.c: In function 'sqlite3_rekey':
C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/codecext.c:250: error: void value not ignored as it ought to be
Regards,
Ulrich
- evstevemd
- Part Of The Furniture
- Posts: 2409
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
Thanks a lot. I will check oututelle wrote:If you try to compile the latest SQLite version 3.7.2 you have to get the latest version of codecext.c first from the wxCode SVN. There were changes in the internal SQLite pager interface.evstevemd wrote:I try to use below settings and I tried without defining them and I got library file and works. When I the preprocessors below I get errors quoted below!
Here are preprocessor directives
SQLITE_CORE
THREADSAFE=1
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
SQLITE_SECURE_DELETE
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
here are errors:
In file included from C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/sqlite3secure.c:50:
C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/codecext.c: In function 'sqlite3_rekey':
C:/Documents and Settings/smtangoo/Desktop/CodeLite/HosannaNeno/sqlite3/codecext.c:250: error: void value not ignored as it ought to be
Regards,
Ulrich
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
utelle, I tried to follow the steps you provided, and it seemed to me that everything compiled and linked well. I wrote a few lines of code to check whether this encryption support is working, but I'm getting exceptions there. Here is my code:utelle wrote: Download the SQLite amalgamation source code from the SQLite download site and copy the sources into subdirectory sqlite3/secure/src/codec-c. Then create a project for compiling SQLite as a static library using your favorite IDE. Add file sqlite3secure.c as the only source file to your project. This file includes all other required source files.
Code: Select all
wxSQLite3Database* db;
try
{
wxString dbName = wxGetCwd() + wxT("/simple.db");
db = new wxSQLite3Database();
db->Open(dbName);
db->ReKey(wxT("somePassword"));
wxSQLite3ResultSet set = db->ExecuteQuery(wxT("SELECT * FROM sample_table"));
if (set.NextRow())
{
wxString s = set.GetAsString(1);
wxMessageBox(s);
}
set.Finalize();
}
catch(wxSQLite3Exception ex)
{
wxMessageBox(ex.GetMessage());
}
- UNKNOWN_ERROR[-1]: error getting symbol <sqlite3_backup_init>
- Couldn't find symbol 'sqlite3_backup_init' in a dynamic library (error 127: the specified procedure couldn't be found.)
Code: Select all
db->Open(dbName);
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
Your code is certainly not the problem. It's the SQLite DLL your application tries to load. It seems you compiled wxSQLite3 against a newer version of SQLite than is found at runtime. Make sure the SQLite DLL matching the version you used to build wxSQLite3 is found first on the search path of your system.qarahat wrote:utelle, I tried to follow the steps you provided, and it seemed to me that everything compiled and linked well. I wrote a few lines of code to check whether this encryption support is working, but I'm getting exceptions there. Here is my code:So I'm gettingCode: Select all
wxSQLite3Database* db; try { wxString dbName = wxGetCwd() + wxT("/simple.db"); db = new wxSQLite3Database(); db->Open(dbName); db->ReKey(wxT("somePassword")); wxSQLite3ResultSet set = db->ExecuteQuery(wxT("SELECT * FROM sample_table")); if (set.NextRow()) { wxString s = set.GetAsString(1); wxMessageBox(s); } set.Finalize(); } catch(wxSQLite3Exception ex) { wxMessageBox(ex.GetMessage()); }
- UNKNOWN_ERROR[-1]: error getting symbol <sqlite3_backup_init>
exceptions when code reaches
- Couldn't find symbol 'sqlite3_backup_init' in a dynamic library (error 127: the specified procedure couldn't be found.)
line. It seems for me that according to last exception some files are missing in the library, but I'm not sure. Your advice to solve the problem would be precious. Thanks in advance.Code: Select all
db->Open(dbName);
Regards,
Ulrich
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
Thanks, Ulrich. I found what was the problem, while compiling wxSQLite3 I used USE_DYNAMIC_SQLITE3_LOAD equals to 1 which was wrong, and after setting that preprocessor to 0, everything worked fine. Today I noticed that everything is clearly described in wxSQLite3's readme file, sorry for disturbing you, instead I could check doc's more carefully . Thanks a lot.utelle wrote: Your code is certainly not the problem. It's the SQLite DLL your application tries to load. It seems you compiled wxSQLite3 against a newer version of SQLite than is found at runtime. Make sure the SQLite DLL matching the version you used to build wxSQLite3 is found first on the search path of your system.
Regards,
Ulrich
-
- Knows some wx things
- Posts: 32
- Joined: Wed Aug 17, 2011 5:13 pm
Re: Compile wxSQLite with encryption and linkingSQLite3.dll
I am sorry to ask again for help here.
I used the sqlite3.lib/.dll in the /sqlite3/secure subfolder and copied the files to sqlite3/lib subdirectory and compiled wxSQLite3. But HasEncryptionSupport() still returns false and when using ReKey() an exception is thrown ("Encryption support not available").
Any ideas here? If I understood correctly the preprocessor symbols
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
SQLITE_CORE
THREADSAFE=1
have to be set when wxSQLite ist compiled, which I did. As the explanation in the readme is not very clear about where to set the symbols exactly, could you provide a detailled description please?
Greetings,
Jens
I used the sqlite3.lib/.dll in the /sqlite3/secure subfolder and copied the files to sqlite3/lib subdirectory and compiled wxSQLite3. But HasEncryptionSupport() still returns false and when using ReKey() an exception is thrown ("Encryption support not available").
Any ideas here? If I understood correctly the preprocessor symbols
SQLITE_HAS_CODEC
CODEC_TYPE=CODEC_TYPE_AES128
SQLITE_CORE
THREADSAFE=1
have to be set when wxSQLite ist compiled, which I did. As the explanation in the readme is not very clear about where to set the symbols exactly, could you provide a detailled description please?
Greetings,
Jens