Page 1 of 1

wxSQLite3 static compilation issue

Posted: Thu May 07, 2015 9:28 am
by John
Dear All,

I'm using the excellent wxWidgets / wxSQLite3 (AES256 activated) under Windows with TDM-GCC.

I've been able to compile wxSQLite3 and I got the " libwxcode_msw30u_wxsqlite3.a " .

But my final executable, statically linked with wxSQLite3, still requires sqlite3.dll to start ???

I'm looking for a way to statically link both (wxSQLite3 and sqlite3 ) libraries so that no dll is required.

Thanx for your help !

John

Re: wxSQLite3 static compilation issue

Posted: Thu May 07, 2015 2:56 pm
by utelle
John wrote:I'm using the excellent wxWidgets / wxSQLite3 (AES256 activated) under Windows with TDM-GCC.

I've been able to compile wxSQLite3 and I got the " libwxcode_msw30u_wxsqlite3.a " .

But my final executable, statically linked with wxSQLite3, still requires sqlite3.dll to start ???

I'm looking for a way to statically link both (wxSQLite3 and sqlite3 ) libraries so that no dll is required.
No changes to wxSQLite3 itself are required except for

1) Use #define wxUSE_DYNAMIC_SQLITE3_LOAD 0 (the default in wxsqlite3opt.h). So nothing to do if you didn't change it yourself.

2) Link to the static SQLite library file. Per default wxSQLite3 links to the SQLite DLL link library located in subfolder sqlite3/lib of the wxSQLite3 distribution. Exchange the SQLite lib file by your own static lib file, or point the linker to the folder of your own static SQLite lib file.

Regards,

Ulrich

Re: wxSQLite3 static compilation issue

Posted: Thu May 07, 2015 4:08 pm
by John
Hi,
Thanks for your prompt answer !

Well, in the directory "wxSQLite3\sqlite3\secure\aes256\dll\release" there is file "sqlite3.a" isn't possible to use it to statically compile wxSQLite3 ?

I've also noticed that I need both "-lwxcode_msw30u_wxsqlite3" and "-lsqlite3" options for my final exe file to link properly.
Does it make sens to you?

Again, thanks for your help :-)

John

Re: wxSQLite3 static compilation issue

Posted: Thu May 07, 2015 6:01 pm
by utelle
John wrote:Well, in the directory "wxSQLite3\sqlite3\secure\aes256\dll\release" there is file "sqlite3.a" isn't possible to use it to statically compile wxSQLite3 ?
No. The file sqlite3.a is a DLL link library (produced from the DLL sqlite3.dll in the same folder using the MinGW toolchain). This is just for convenience for Windows users not using Visual C++.

wxSQLite3 does not include a precompiled static SQLite library. On this forum you will find some postings how to compile SQLite3 as a static library yourself.
John wrote:I've also noticed that I need both "-lwxcode_msw30u_wxsqlite3" and "-lsqlite3" options for my final exe file to link properly. Does it make sens to you?
Sure. If you link to a static library you have to specify for the linker all dependent libraries, too, in this case sqlite3.

If you use a SQLite3 DLL, then the linker dependency on sqlite3.a can be eliminated by compiling wxSQLite3 with the option

#define wxUSE_DYNAMIC_SQLITE3_LOAD 1

At runtime the SQLite3 DLL has to be on the path and wxSQLite3 will load the DLL dynamically.

Regards,

Ulrich

Re: wxSQLite3 static compilation issue

Posted: Thu May 07, 2015 9:40 pm
by doublemax
I usually just add the wxSqlite3 and the sqlite amalgamation source files to my project instead of building separate libraries for them.

Re: wxSQLite3 static compilation issue

Posted: Tue May 12, 2015 12:40 pm
by John
Dear Moderators,

:D !! THANKS !! :D

I've been carefully studying your guidelines and it has worked: my problem is solved.
Thank you so much for your help, it's really great from you !

John