wxSQLite3 static compilation issue

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
John
Earned a small fee
Earned a small fee
Posts: 17
Joined: Thu May 07, 2015 9:16 am

wxSQLite3 static compilation issue

Post 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
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSQLite3 static compilation issue

Post 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
John
Earned a small fee
Earned a small fee
Posts: 17
Joined: Thu May 07, 2015 9:16 am

Re: wxSQLite3 static compilation issue

Post 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
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSQLite3 static compilation issue

Post 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
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxSQLite3 static compilation issue

Post by doublemax »

I usually just add the wxSqlite3 and the sqlite amalgamation source files to my project instead of building separate libraries for them.
Use the source, Luke!
John
Earned a small fee
Earned a small fee
Posts: 17
Joined: Thu May 07, 2015 9:16 am

Re: wxSQLite3 static compilation issue

Post 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
Post Reply