wxSqlite3 + mingw32 + static lib Topic is solved

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

wxSqlite3 + mingw32 + static lib

Post by Allonii »

Hello!

I have a problem compiling the wxSqlite3 library as an static one to be able to use it in my projects without a DLL.

There is no tutorial but im doing this.

1. Download sqlite-source-3_6_16 (to be able to use encryption) and build it with C::B as an static library.

2. I get an libSqlite3.a (~800 kb), I copy and put it under
C:\wxsqlite3-1.9.5\sqlite3\lib.

3. I change in the C:\wxsqlite3-1.9.5\build\makefile.gcc so it fits my wxWidgets build and use USE_DYNAMIC_SQLITE3_LOAD = 0.

4. Then open cmd and compile: mingw32-make -f makefile.gcc
5. I get an libwxcode_msw28u_wxsqlite3.a (~270 kb) and a dll (~3.5 MB) with the same name, In C:\wxsqlite3-1.9.5\lib\gcc_lib.

6. I copy that file to C:\wxWidgets-2.8.10\lib\gcc_lib and add the file name in my Project->Build Option->Linker Settings

After all this when I compile the sample in wxSqlite3 i get
"wx/wxsqlite3.h: No such file or directory" and alot other errors.

So what im I doing wrong? why is this not working?

Thanks
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxSqlite3 + mingw32 + static lib

Post by utelle »

Allonii wrote:I have a problem compiling the wxSqlite3 library as an static one to be able to use it in my projects without a DLL.

There is no tutorial but im doing this.
What exactly do you want to accomplish? No SQLite DLL? No wxSQLite3 DLL? No DLL at all?

If you don't want a wxSQLite3 DLL then I would recommend to just add all wxSQLite3 source files to your own application.
Allonii wrote:1. Download sqlite-source-3_6_16 (to be able to use encryption) and build it with C::B as an static library.

2. I get an libSqlite3.a (~800 kb), I copy and put it under
C:\wxsqlite3-1.9.5\sqlite3\lib.
In general this approach is ok. But to use encryption you have to build SQLite including the encryption extension. Due to changes of the internal SQLite encryption interface in the latest SQLite version 3.6.16 the encryption extension coming with wxSQLite3 does currently not compile with this SQLite version. I'm working on this issue.
Allonii wrote:3. I change in the C:\wxsqlite3-1.9.5\build\makefile.gcc so it fits my wxWidgets build and use USE_DYNAMIC_SQLITE3_LOAD = 0.

4. Then open cmd and compile: mingw32-make -f makefile.gcc
5. I get an libwxcode_msw28u_wxsqlite3.a (~270 kb) and a dll (~3.5 MB) with the same name, In C:\wxsqlite3-1.9.5\lib\gcc_lib.
That should be ok. Although if you get a DLL then you have specified WX_SHARED=1.
Allonii wrote:6. I copy that file to C:\wxWidgets-2.8.10\lib\gcc_lib and add the file name in my Project->Build Option->Linker Settings

After all this when I compile the sample in wxSqlite3 i get
"wx/wxsqlite3.h: No such file or directory" and alot other errors.
How do you compile the sample? Apparently your compiler did not find the wxSQLite3 header files. You have to specify in your compiler settings where the necessary header files can be found, that is in C:\wxsqlite3-1.9.5\include in your case.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

Hi Ulrich!

Thanks for the replay
What exactly do you want to accomplish? No SQLite DLL? No wxSQLite3 DLL? No DLL at all?
Well yes im trying to get everything to work without any dll.
That should be ok. Although if you get a DLL then you have specified WX_SHARED=1
Yes, its true i changed it to 0. And now I only get a
libwxcode_msw28u_wxsqlite3.a (~170 kb)
But to use encryption you have to build SQLite including the encryption extension.
Don't really understand, aren't the extension included in the sqlite sources?
How do you compile the sample? Apparently your compiler did not find the wxSQLite3 header files. You have to specify in your compiler settings where the necessary header files can be found, that is in C:\wxsqlite3-1.9.5\include in your case.
I must have forgotten this, but i copied the include to the wx include dir and now its telling me alot of undefined refernces in libwxcode_msw28u_wxsqlite3.a. =(

EDIT: I added the static build library sqlite.a from before to my linker and now I only get 7 errors and 3 warnings when im building my project. All the errors are related to wxRegEx, undified reference. any ides?
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle »

Allonii wrote:
What exactly do you want to accomplish? No SQLite DLL? No wxSQLite3 DLL? No DLL at all?
Well yes im trying to get everything to work without any dll.
That should be ok. Although if you get a DLL then you have specified WX_SHARED=1
Yes, its true i changed it to 0. And now I only get a
libwxcode_msw28u_wxsqlite3.a (~170 kb)
Sounds ok.
Allonii wrote:
But to use encryption you have to build SQLite including the encryption extension.
Don't really understand, aren't the extension included in the sqlite sources?
No, not in the original SQLite sources available from http://www.sqlite.org. If you need encryption you have several options:

1) D.R. Hipp, author of SQLite, offers a commercial encryption extension.

2) The SQLite wrapper System.Data.SQLite contains an encryption extension for Windows platforms only.

3) The SQLite wrapper wxSQLite3 contains a portable encryption extension known to work on Windows, Linux and Mac platforms.

In any case you have to build SQLite using the sources of one of these extensions to get encryption support.
Allonii wrote:
... You have to specify in your compiler settings where the necessary header files can be found, that is in C:\wxsqlite3-1.9.5\include in your case.
I must have forgotten this, but i copied the include to the wx include dir and now its telling me alot of undefined refernces in libwxcode_msw28u_wxsqlite3.a. =(

EDIT: I added the static build library sqlite.a from before to my linker and now I only get 7 errors and 3 warnings when im building my project. All the errors are related to wxRegEx, undified reference. any ides?
Well, without seeing the linker messages I can only guess. wxSQLite3 implements a user defined function for the SQLite REGEXP operator. This function uses the wxRegEx class from the wxWidgets base library. If you get undefined references the linker is not able to resolve them. So either a reference to the wxWidgets base library is missing on the linker command line or the order of the specified libraries is wrong.

Please post the command line how the compiler and linker are invoked and the resulting error messages. This might give a hint what's going wrong.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

3) The SQLite wrapper wxSQLite3 contains a portable encryption extension known to work on Windows, Linux and Mac platforms.
This one sounds best. So all I have to do to get the encryption to work is take the files from sqlite3\secure\src\codec and paste them into sqlite source and compile again as an static lib?
Please post the command line how the compiler and linker are invoked and the resulting error messages. This might give a hint what's going wrong.
Im building the project from C::B and the project is just the minimal from wxsqlite\samples.

The Linker Libraries are:
libwxmsw28u.a
libwxpng.a
libwxjpeg.a
libwxtiff.a
libwxzlib.a
libwxcode_msw28u_wxsqlite3.a
..\..\..\..\..\wxsqlite\sqlite3\lib\sqlite3.a

I have a wxWidget Build: Unicode=1 Monolithic=1 Static=1 Release = 1
wxWidget version:2.8.10
The map wxsqlite = wxsqlite3-1.9.5

Search Directories:
Compiler: $(#wx)\lib\gcc_lib\mswu
Linker: $(#wx)\lib\gcc_lib
Resource: $(#wx)\lib\gcc_lib\mswu

And the error message when I compile:

||=== SimpleSqlite2, Release ===|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x10892)||undefined reference to `wxRegEx::Init()'|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x10972)||undefined reference to `wxRegEx::Init()'|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x10a45)||undefined reference to `wxRegEx::~wxRegEx()'|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x10b35)||undefined reference to `wxRegEx::~wxRegEx()'|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x10c25)||undefined reference to `wxRegEx::~wxRegEx()'|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x10f47)||undefined reference to `wxRegEx::Matches(wchar_t const*, int, unsigned int) const'|
C:\wxWidgets-2.8.10\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a(wxsqlite3_lib_wxsqlite3.o):wxsqlite3.cpp:(.text+0x11351)||undefined reference to `wxRegEx::Compile(wxString const&, int)'|
||=== Build finished: 7 errors, 0 warnings ===|


Thanks

EDIT: One more thing that is interesting, when I compile wxsqlite from the makefile all goes well and the minimal gets compiled to but it requires the sqlite.dll.
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle »

Allonii wrote:So all I have to do to get the encryption to work is take the files from sqlite3\secure\src\codec and paste them into sqlite source and compile again as an static lib?
Essentially yes. You also find some hints in the readme file accompanying wxSQLite3. And the following thread in this forum might be helpful, too: http://forums.wxwidgets.org/viewtopic.php?t=24481
Allonii wrote:Im building the project from C::B and the project is just the minimal from wxsqlite\samples.

The Linker Libraries are:
libwxmsw28u.a
libwxpng.a
libwxjpeg.a
libwxtiff.a
libwxzlib.a
libwxcode_msw28u_wxsqlite3.a
..\..\..\..\..\wxsqlite\sqlite3\lib\sqlite3.a

I have a wxWidget Build: Unicode=1 Monolithic=1 Static=1 Release = 1
wxWidget version:2.8.10
The map wxsqlite = wxsqlite3-1.9.5
Maybe you only have to add libwxregex.a to the list. (I don't have experience with the monolithic wxWidgets build.)

Additionally you should place libwxcode_msw28u_wxsqlite3.a before all other libraries. For the gcc linker the order of libraries is important.
Allonii wrote:EDIT: One more thing that is interesting, when I compile wxsqlite from the makefile all goes well and the minimal gets compiled to but it requires the sqlite.dll.
Both conditions mentioned above are met by the wxSQLite3 makefiles: lib wxregex is included and lib wxsqlite3 is specified as the first library.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

Maybe you only have to add libwxregex.a to the list. (I don't have experience with the monolithic wxWidgets build.)
Additionally you should place libwxcode_msw28u_wxsqlite3.a before all other libraries. For the gcc linker the order of libraries is important.
This is what I did, I searched the entire hardrive for libwxregex.a and I did not find it in my wx dir. But I have wx-Devcpp installed and there it was. I moved the libwxcode_msw28u_wxsqlite3.a to be the first library and added libwxregex.a, thats all I got a exe (~3 MB) without any dll.

Thanks Ulrich!

P.S Your sample in wxsqlite does it ever stop? When i execute the minimal, no console shows and it keeps running in the background. The program takes all the cpu power.
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle »

Allonii wrote:P.S Your sample in wxsqlite does it ever stop?
It certainly should. After starting the minimal application a console window should appear showing all output produced while performing the tests and at the end the user is asked to press 'q' or 'Q' to stop the application and close the console window.
Allonii wrote:When i execute the minimal, no console shows and it keeps running in the background. The program takes all the cpu power.
Well, that's really strange. Have you tried to start the application from a command prompt? In that case you should see all test output in the same window. Or if something is wrong you should see an error message.

If the SQLite library was built correctly minimal should definitely work without problems.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

It certainly should. After starting the minimal application a console window should appear showing all output produced while performing the tests and at the end the user is asked to press 'q' or 'Q' to stop the application and close the console window.
Its true your minimal works fine with the command prompt and the sqlite.dll but mine won't show anything. This means that it is not compiled right....Damn this is pain in the ass.

What do you suggest compile everything again?
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle »

Allonii wrote:Its true your minimal works fine with the command prompt and the sqlite.dll but mine won't show anything. This means that it is not compiled right....Damn this is pain in the ass.

What do you suggest compile everything again?
Well, first thing would be to check whether you used exactly the same options building your application as you did when building wxWidgets itself. The build type must match otherwise runtime behaviour is unpredictable.

Another thing you should check is whether the right version of wxWidgets is referenced. Sometimes there exist different versions on the path depending on your setup.

Third thing you should check is whether the SQLite library you built yourself is working properly. The SQLite sources contain the file shell.c which is a command line utility to manipulate a SQLite database. Build this utility and try to create and manipulate a test database.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

Well, first thing would be to check whether you used exactly the same options building your application as you did when building wxWidgets itself. The build type must match otherwise runtime behaviour is unpredictable.

Another thing you should check is whether the right version of wxWidgets is referenced. Sometimes there exist different versions on the path depending on your setup.
Here I only use C::B settings so I never change anything.

Now im back at square one I cant compile the wxsqlite, its telling me alot of undefined references.

I think the problem is in the makefile.gcc.

As said before I have a wxWidget Build: Unicode=1 Monolithic=1 Static=1 Release = 1
wxWidget version:2.8.10

I have changed in the makefile.gcc alot of times but are these makefile settings ok?

# Compiler flags to link shared library
LINK_DLL_FLAGS = -static

# C++ compiler
CXX = g++

# Standard flags for C++
CXXFLAGS ?=

# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=

# Standard linker flags
LDFLAGS ?=

# Use DLL build of wx library? [0,1]
WX_SHARED = 0

# Use Unicode build of wxWidgets? [0,1]
WX_UNICODE = 1

# Use debug build of wxWidgets (define __WXDEBUG__)? [0,1]
WX_DEBUG = 0

# Version of the wx library to build against.
WX_VERSION = 28

# Use monolithic build of wxWidgets? [0,1]
WX_MONOLITHIC = 1

# The directory where wxWidgets library is installed
WX_DIR = $(WXWIN)

# Build this wxCode component as DLL or as static library? [0,1]
SHARED = 0

# If 1 then the SQLite library will be loaded dynamically at run time [1,0]
USE_DYNAMIC_SQLITE3_LOAD = 0

# If 1 then the SQLite library has to be compiled with meta data support [1,0]
HAVE_METADATA ?= 0

# If 1 then the SQLite library has to be compiled with codec support [1,0]
HAVE_CODEC ?= 0

# If 1 then the SQLite library has to be compiled with loadable extension support [1,0]
HAVE_LOAD_EXTENSION ?= 0

# Folder where the SQLite3 link library is located
SQLITE3_DIR ?= ..\sqlite3
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle »

Allonii wrote:Here I only use C::B settings so I never change anything.
Unfortunately I can't say much about how to use C::B since I use Visual C++ Express for my own projects.
Allonii wrote:Now im back at square one I cant compile the wxsqlite, its telling me alot of undefined references.
Without seeing how gcc was invoked (including all command line options) and the rsulting error messages it's hard to guess what's causing the problems. Maybe one of the search paths is wrong or the order of link libraries.
Allonii wrote:I think the problem is in the makefile.gcc.
Which one? That of your own project? I ask since you stated in a prior post that you were able to create a working minimal using the makefile. The original makefile coming with wxSQLite3 references the SQLite library in the subdirectory sqlite3/lib of the component. If you copy the static SQLite library you created to this directory you will get an application not requiring a SQLite3 DLL any more.
Allonii wrote:As said before I have a wxWidget Build: Unicode=1 Monolithic=1 Static=1 Release = 1
wxWidget version:2.8.10

I have changed in the makefile.gcc alot of times but are these makefile settings ok?
The settings seem to be ok.
Allonii wrote:# The directory where wxWidgets library is installed
WX_DIR = $(WXWIN)
Is $(WXWIN) pointing to the right directory?
Allonii wrote:# If 1 then the SQLite library has to be compiled with meta data support [1,0]
HAVE_METADATA ?= 0
Consider to set this option to 1.
Allonii wrote:# If 1 then the SQLite library has to be compiled with codec support [1,0]
HAVE_CODEC ?= 0
If you want to use the encryption extension you must set this option to 1.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

Thanks for the support Ulrich! here goes again...
Without seeing how gcc was invoked (including all command line options) and the rsulting error messages it's hard to guess what's causing the problems. Maybe one of the search paths is wrong or the order of link libraries.

Which one? That of your own project? I ask since you stated in a prior post that you were able to create a working minimal using the makefile. The original makefile coming with wxSQLite3 references the SQLite library in the subdirectory sqlite3/lib of the component. If you copy the static SQLite library you created to this directory you will get an application not requiring a SQLite3 DLL any more.
This is what im doing, so the steps can be followed easy

1.I start with compiling all sqlite-source-3_6_16 including the files in sqlite3\secure\src\codec. (except the shell and tclsqlite). As an static library with C::B. I get 13 warnings

||=== Sqlite3, Release ===|
..\sqlite-source-3_6_16\codec.h|33|warning: "PAGER_MJ_PGNO" redefined|
..\sqlite-source-3_6_16\pager.h|55|warning: this is the location of the previous definition|
..\sqlite-source-3_6_16\fts3_expr.c||In function `fts3ExprParse': |
..\sqlite-source-3_6_16\fts3_expr.c|235|warning: 'zNew' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c||In function `ChooseLeaf': |
..\sqlite-source-3_6_16\rtree.c|1334|warning: 'iBest' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1336|warning: 'fMinGrowth' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1337|warning: 'fMinArea' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1338|warning: 'fMinOverlap' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c||In function `rtreeInsertCell': |
..\sqlite-source-3_6_16\rtree.c|1754|warning: 'iBestDim' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1755|warning: 'iBestSplit' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1756|warning: 'fBestMargin' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1778|warning: 'fBestOverlap' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1779|warning: 'fBestArea' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c|1780|warning: 'iBestLeft' might be used uninitialized in this function|
||=== Build finished: 0 errors, 13 warnings ===|


2.I get an libSqlite3.a and copy it to wxsqlite3-1.9.5\sqlite3\lib.

3.I change the makefile.gcc in wxsqlite3-1.9.5\build as we talked about before and also applied your suggestions.

4.I start cmd and go the the folder wxsqlite3-1.9.5\build
then i only type: mingw32-make -f makefile.gcc
and there I get the undefined references and a error for the minimal example.

mingw says: First alot of settings that are included in the makefile and then
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0x38fe>: undefined reference to 'sqlite3_column_database_name'
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0x3b0e>: undefined reference to 'sqlite3_column_table_name'
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0x3d1e>: undefined reference to 'sqlite3_column_origin_name'
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0xbbfe>: undefined reference to 'sqlite3_key'
and couple of more of these

Thats all to it, maby im not calling the mingw right?
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle »

Allonii wrote:This is what im doing, so the steps can be followed easy

1.I start with compiling all sqlite-source-3_6_16 including the files in sqlite3\secure\src\codec. (except the shell and tclsqlite). As an static library with C::B. I get 13 warnings

||=== Sqlite3, Release ===|
..\sqlite-source-3_6_16\codec.h|33|warning: "PAGER_MJ_PGNO" redefined|
..\sqlite-source-3_6_16\pager.h|55|warning: this is the location of the previous definition|
..\sqlite-source-3_6_16\fts3_expr.c||In function `fts3ExprParse': |
..\sqlite-source-3_6_16\fts3_expr.c|235|warning: 'zNew' might be used uninitialized in this function|
..\sqlite-source-3_6_16\rtree.c||In function `ChooseLeaf': |
..\sqlite-source-3_6_16\rtree.c|1334|warning: 'iBest' might be used uninitialized in this function|
...
..\sqlite-source-3_6_16\rtree.c|1780|warning: 'iBestLeft' might be used uninitialized in this function|
||=== Build finished: 0 errors, 13 warnings ===|
The first warning will go away if you use the latest version of the wxSQLite3 encryption extension I uploaded yesterday to the wxCode SVN.

I'm a bit irritated as you compiled version 3.6.16 of SQLite but did not get compile time errors since as said before the encryption extension coming with wxSQLite3 1.9.5 is not compatible with SQLite 3.6.16. Most probably you forgot to define some preprocessor symbols.

The following symbols should be defined (as mentioned in http://forums.wxwidgets.org/viewtopic.php?t=24481):

THREADSAFE=1
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_HAS_CODEC
SQLITE_SECURE_DELETE
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
SQLITE_CORE
Allonii wrote:2.I get an libSqlite3.a and copy it to wxsqlite3-1.9.5\sqlite3\lib.

3.I change the makefile.gcc in wxsqlite3-1.9.5\build as we talked about before and also applied your suggestions.
These steps are ok.
Allonii wrote:4.I start cmd and go the the folder wxsqlite3-1.9.5\build
then i only type: mingw32-make -f makefile.gcc
and there I get the undefined references and a error for the minimal example.

mingw says: First alot of settings that are included in the makefile and then
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0x38fe>: undefined reference to 'sqlite3_column_database_name'
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0x3b0e>: undefined reference to 'sqlite3_column_table_name'
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0x3d1e>: undefined reference to 'sqlite3_column_origin_name'
..\lib\gcc_lib\libwxcode_msw28u_wxsqlite3.a<wxsqlite3_lib_wxsqlite3.o>:wxsqlite3.cpp:<.text+0xbbfe>: undefined reference to 'sqlite3_key'
and couple of more of these
Well, this indicates that at least the preprocessor symbols SQLITE_ENABLE_COLUMN_METADATA and SQLITE_HAS_CODEC were not defined when building the SQLite library.
Allonii wrote:Thats all to it, maby im not calling the mingw right?
Up to now the errors are all related to the missing preprocessor symbols.

Regards,

Ulrich
Allonii
Experienced Solver
Experienced Solver
Posts: 83
Joined: Wed Jun 24, 2009 1:28 pm

Post by Allonii »

Lets start a story again and hopefully this should be the last one. I really hope this will help, if someone ever has the same problem.

1.First I started be downloading the suggested files by Ulrich from the link.
THREADSAFE=1
SQLITE_SOUNDEX
SQLITE_ENABLE_COLUMN_METADATA
SQLITE_HAS_CODEC
SQLITE_SECURE_DELETE
SQLITE_ENABLE_FTS3
SQLITE_ENABLE_FTS3_PARENTHESIS
SQLITE_ENABLE_RTREE
SQLITE_CORE
2.Then I copied the files into the SQLite 3.6.16 source and added the symbols above to Project->Build Option->Compiler Settings -> #defines.

3.Compiled the static sqlite lib (only 15 warnings) and copied the output to wxsqlite3-1.9.5\sqlite3\lib.

4.Started cmd and went to wxsqlite3-1.9.5\build and gave mingw another round this time it compiled with the errors:
..already defined
..already defined

5.Then I saw a previous post by Ulrich in another thread.
The reason for all those warnings is that you included both, pager_secure.c and pager.c, in your project. Drop pager.c from your project (as it is included by pager_sevure.c) and the warnings will vanish.
6.So I did and remade step 3,4 again but this time without any error, and the sample in wxsqlite3-1.9.5\samples worked without any dll.

7.Back to my project I could not compile because the error about wxRegEx, even though I had it linked to libwxregex.a. But in the wxWidget library there is something called libwxregexu.a so I change the linker settings to the later of the libraries and thats all folks.

Now the minimal sample compiles and runs without any dll at all.

A big thanks to Ulrich.

P.S. Ulrich maby you should write a simple tutorial about the compiling part, I can help if you wish.
Thanks

Allonii
Post Reply