Setting up wxSQLite3 on Linux (w/Code::Blocks) challenge. Topic is solved
Setting up wxSQLite3 on Linux (w/Code::Blocks) challenge.
I have been struggling to get a Linux Mint C++ devel PC to work with wxSQLite3 and I need some experienced input.
Whenever wxSQLite3.cpp is in my project's Sources, the compiler overloads from errors in the wxsqlite3.cpp file.
When wxsqlite3.cpp isn't in my Sources, the references to the wxsqlite3.cpp commands are all error of course.
I have a similar project in a Win 7 using wxSQLite3.cpp without issue.
I'm trying to understand what is at fault, It seems like my wxSQLite3 is not (properly) compiled.
wxSQLite.cpp has 50 errors when I build it alone. See attached.
I'm trying to finish a couple installs of this combination where someone else left off.
Using C::B 16.01, wxWidgets 3.02, 64Bit.
Any advice greatly appreciated.
Whenever wxSQLite3.cpp is in my project's Sources, the compiler overloads from errors in the wxsqlite3.cpp file.
When wxsqlite3.cpp isn't in my Sources, the references to the wxsqlite3.cpp commands are all error of course.
I have a similar project in a Win 7 using wxSQLite3.cpp without issue.
I'm trying to understand what is at fault, It seems like my wxSQLite3 is not (properly) compiled.
wxSQLite.cpp has 50 errors when I build it alone. See attached.
I'm trying to finish a couple installs of this combination where someone else left off.
Using C::B 16.01, wxWidgets 3.02, 64Bit.
Any advice greatly appreciated.
- Attachments
-
- wxsqlite_build.txt
- (13.15 KiB) Downloaded 119 times
Last edited by AshtonC1 on Mon Apr 17, 2017 2:16 pm, edited 4 times in total.
Re: Setting up wxSQLite3 on Linux, with Code::Blocks 16.01
I can't help with the build of wxSQlite3 as a library. I just add all source files to my project as if they were mine.
The files you need are:
sqlite3.c
sqlite3.h
sqlite3ext.h (these 3 files are from the SQLite amalgamation archive)
wxsqlite3.cpp
wxsqlite3.h
wxsqlite3def.h
wxsqlite3dyn.h
wxsqlite3opt.h
The files you need are:
sqlite3.c
sqlite3.h
sqlite3ext.h (these 3 files are from the SQLite amalgamation archive)
wxsqlite3.cpp
wxsqlite3.h
wxsqlite3def.h
wxsqlite3dyn.h
wxsqlite3opt.h
Use the source, Luke!
Re: Setting up wxSQLite3 on Linux, with Code::Blocks 16.01
For one, you seem to use an outdated (or at least modified) version of wxSQLite3, since the first error listed in your build log emits the line number 438 (while it should have been 454, if you were using the latest wxSQLite3 version).AshtonC1 wrote:I have been struggling to get a Linux Mint C++ devel PC to work with wxSQLite3 and I need some experienced input.
Whenever wxSQLite3.cpp is in my project's Sources, the compiler overloads from errors in the wxsqlite3.cpp file.
When wxsqlite3.cpp isn't in my Sources, the references to the wxsqlite3.cpp commands are all error of course.
I have a similar project in a Win 7 using wxSQLite3.cpp without issue.
I'm trying to understand what is at fault, It seems like my wxSQLite3 is not (properly) compiled.
wxSQLite.cpp has 50 errors when I build it alone. See attached.
Obviously your compiler fails to use or interpret the wxSQLite3 header file wxsqlite3.h. It is amazing that the compiler doesn't throw an error message on not finding the header file, although there is no additional include path on the compiler command line. Could you please check where the compiler might find the wxSQLite3 header files? And please check which wxSQLite3 version you are actually using.
I would recommend to download the latest wxSQLite3 release and to use autoreconf / configure to build the wxSQLite3 library, and then to just reference the wxSQLite3 library from your project. The current wxSQLite3 release includes and statically links the SQLite3 library itself and supports database encryption out of the box.
Alternatively you could add all wxSQLite3 sources files to your own project as doublemax proposed. However, just adding the source files from the SQLite amalgamation distro will not allow you to use database encryption easily.
Regards,
Ulrich
Re: Setting up wxSQLite3 on Linux, with Code::Blocks 16.01
Thanks
It looks like wxSqlite3 is Not properly installed, as when I check the version (wxsqlite3 --version) gives 'command not found'.
I'm working on getting the newest version.
The version available in software manager is Libwxsqlite3-3.0-0, I have installed it, but the version query still gives 'command not found'.
Also, I'm looking for the examples as I've read about in the wxSQLite3 catalog. Can't find a Catalog.
It looks like wxSqlite3 is Not properly installed, as when I check the version (wxsqlite3 --version) gives 'command not found'.
I'm working on getting the newest version.
The version available in software manager is Libwxsqlite3-3.0-0, I have installed it, but the version query still gives 'command not found'.
Also, I'm looking for the examples as I've read about in the wxSQLite3 catalog. Can't find a Catalog.
Re: Setting up wxSQLite3 on Linux, with Code::Blocks 16.01
Some Linux distributions offer precompiled wxSQLite3 packages. AFAIK the package Libwxsqlite3-3.0-0 you mentioned bundles wxSQLite3 versiom 3.3.0. The current version of wxSQLite3 is 3.5.3 (see wxSQLite3 releases at github). If you are developing wxWidgets applications yourself, I would recommend that you download the latest wxSQLite3 version and compile it yourself.AshtonC1 wrote:It looks like wxSqlite3 is Not properly installed, as when I check the version (wxsqlite3 --version) gives 'command not found'.
I'm working on getting the newest version.
The version available in software manager is Libwxsqlite3-3.0-0, I have installed it, but the version query still gives 'command not found'.
Also, I'm looking for the examples as I've read about in the wxSQLite3 catalog. Can't find a Catalog.
Regards,
Ulrich
Re: Setting up wxSQLite3 on Linux, with Code::Blocks 16.01
I succeeded in creating a 'configure' file using 'autoreconf', then make generated the following result.
Does this look correct?
make install succeeded.
Does this look correct?
- OptiPlex780-1 wxsqlite3-3.5.3 # make
CC sqlite3/secure/src/sqlite3secure.lo
CXX src/wxsqlite3.lo
CXXLD libwxcode_gtk2u_wxsqlite3-3.0.la
ar: `u' modifier ignored since `D' is the default (see `U')
CXX samples/minimal.o
CXXLD samples/minimal
CXX samples/treeview/foldertree.o
CXX samples/treeview/projectlist.o
CXX samples/treeview/treeviewapp.o
CXX samples/treeview/treeviewsample.o
CXXLD samples/treeview/treeview
make install succeeded.
Re: Setting up wxSQLite3 on Linux, with Code::Blocks 16.01
Except for the warning message from "ar" this output looks the same as that of the "Building" step of wxSQLite3 Travis CI. So I assume you should now have a usable wxSQLite3 library installed.AshtonC1 wrote:I succeeded in creating a 'configure' file using 'autoreconf', then make generated the following result.
Does this look correct?Looks very different from other builds I have seen displayed.
- OptiPlex780-1 wxsqlite3-3.5.3 # make
CC sqlite3/secure/src/sqlite3secure.lo
CXX src/wxsqlite3.lo
CXXLD libwxcode_gtk2u_wxsqlite3-3.0.la
ar: `u' modifier ignored since `D' is the default (see `U')
CXX samples/minimal.o
CXXLD samples/minimal
CXX samples/treeview/foldertree.o
CXX samples/treeview/projectlist.o
CXX samples/treeview/treeviewapp.o
CXX samples/treeview/treeviewsample.o
CXXLD samples/treeview/treeview
make install succeeded.
You will have to adjust the build of your own project to now reference the installed wxSQLite3 library.
Regards,
Ulrich
Re: Setting up wxSQLite3 on Linux challenge.
Thank you.
A followup question please.
I am now creating a simple test wxSQLite3 project (in Linux, C::B, wxW, wxSQLite, C++), based on a Windows C::B project example I followed in the past.
https://drive.google.com/file/d/0B1Jtvy ... xLeHM/edit
It's is mostly compiling except it is finding problems in wxsqlite3.cpp with 12 Undefined References.
The wxSQLite3.cpp is listed in my Workspace, Sources.
Could you please give a quick opinion on a possible cause?
Build log:
With wxSQLite3.cpp removed from project Sources and all function terms commented, 0 error(s), 0 warning(s).
any advice appreciated.
A followup question please.
I am now creating a simple test wxSQLite3 project (in Linux, C::B, wxW, wxSQLite, C++), based on a Windows C::B project example I followed in the past.
https://drive.google.com/file/d/0B1Jtvy ... xLeHM/edit
It's is mostly compiling except it is finding problems in wxsqlite3.cpp with 12 Undefined References.
The wxSQLite3.cpp is listed in my Workspace, Sources.
Could you please give a quick opinion on a possible cause?
Build log:
Code: Select all
-------------- Build: Debug in wxSQLi_417 (compiler: GNU GCC Compiler)---------------
g++ -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Wall -g -I/home/dan/wxsqlite3-3.5.3/include -I/home/dan/wxsqlite3-3.5.3/sqlite3/secure/src -I/home/dan/wxsqlite3-3.5.3/include/wx -c /home/dan/Documents/wxW_Projs/wxSQLi_417/wxSQLi_417Main.cpp -o obj/Debug/wxSQLi_417Main.o
g++ -o bin/Debug/wxSQLi_417 obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o obj/Debug/wxSQLi_417App.o obj/Debug/wxSQLi_417Main.o -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 /usr/local/lib/libsqlite3.a -ldl
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3ResultSet::GetDatabaseName(int)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:1270: undefined reference to `sqlite3_column_database_name'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3ResultSet::GetTableName(int)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:1290: undefined reference to `sqlite3_column_table_name'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3ResultSet::GetOriginName(int)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:1310: undefined reference to `sqlite3_column_origin_name'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::Open(wxString const&, wxMemoryBuffer const&, int)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:2739: undefined reference to `sqlite3_key'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::Backup(wxSQLite3BackupProgress*, wxString const&, wxMemoryBuffer const&, wxString const&)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:2867: undefined reference to `sqlite3_key'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::Restore(wxSQLite3BackupProgress*, wxString const&, wxMemoryBuffer const&, wxString const&)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:2980: undefined reference to `sqlite3_key'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::ReKey(wxMemoryBuffer const&)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:3913: undefined reference to `sqlite3_rekey'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::UserLogin(wxString const&, wxString const&)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:3934: undefined reference to `sqlite3_user_authenticate'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::UserAdd(wxString const&, wxString const&, bool)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:3958: undefined reference to `sqlite3_user_add'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::UserChange(wxString const&, wxString const&, bool)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:3983: undefined reference to `sqlite3_user_change'
obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o: In function `wxSQLite3Database::UserDelete(wxString const&)':
/home/dan/wxsqlite3-3.5.3/src/wxsqlite3.cpp:4006: undefined reference to `sqlite3_user_delete'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
12 error(s), 0 warning(s) (0 minute(s), 2 second(s))
any advice appreciated.
Re: Setting up wxSQLite3 on Linux challenge.
In your archive no file wxsqlite3.cpp is included. And of course it shouldn't, because you will now use a precompiled library.AshtonC1 wrote:I am now creating a simple test wxSQLite3 project (in Linux, C::B, wxW, wxSQLite, C++), based on a Windows C::B project example I followed in the past.
https://drive.google.com/file/d/0B1Jtvy ... xLeHM/edit
It's is mostly compiling except it is finding problems in wxsqlite3.cpp with 12 Undefined References.
The wxSQLite3.cpp is listed in my Workspace, Sources.
Let's take a look at the compiler invocations:AshtonC1 wrote:Could you please give a quick opinion on a possible cause?
With wxSQLite3.cpp removed from project Sources and all function terms commented, 0 error(s), 0 warning(s).
Code: Select all
g++ -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -Wall -g -I/home/dan/wxsqlite3-3.5.3/include -I/home/dan/wxsqlite3-3.5.3/sqlite3/secure/src -I/home/dan/wxsqlite3-3.5.3/include/wx -c /home/dan/Documents/wxW_Projs/wxSQLi_417/wxSQLi_417Main.cpp -o obj/Debug/wxSQLi_417Main.o
Code: Select all
g++ -o bin/Debug/wxSQLi_417 obj/Debug/wxsqlite3-3.5.3/src/wxsqlite3.o obj/Debug/wxSQLi_417App.o obj/Debug/wxSQLi_417Main.o -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 /usr/local/lib/libsqlite3.a -ldl
Regards,
Ulrich
Re: Setting up wxSQLite3 on Linux challenge.
Ulrich,If you installed wxSQLite3 as you claimed you did, you will just have to add a linker reference, i.e. -lwxcode_gtk2u_wxsqlite3-3.0, instead of the object file wxsqlite3.o. And don't use a linker reference to /usr/local/lib/libsqlite3.a, since it is most probably an out-dated SQLite library.
Thank You very much, that solved the compile, with references to 'wxSQLite3Database' commented.
I could have never determined, on my own, that this linker reference '-lwxcode_gtk2u_wxsqlite3-3.0' was necessary.
The working-configuration of this test project (with wxSQLite3) on Linux is very different from the Windows version.
I must now identify problems caused by incorrect references like this:
Code: Select all
db->Open(testDBName);
Imay post this as a C++ Development question.
Re: Setting up wxSQLite3 on Linux challenge.
Well, Linux and Windows are very different platforms.AshtonC1 wrote:Thank You very much, that solved the compile, with references to 'wxSQLite3Database' commented.
I could have never determined, on my own, that this linker reference '-lwxcode_gtk2u_wxsqlite3-3.0' was necessary.
The working-configuration of this test project (with wxSQLite3) on Linux is very different from the Windows version.
Without additional information it is impossible to say why your application does not run. You should use a debugger to find out where exactly your application seizes to work. From just the one quoted source line it is hardly possible to deduce any cause for failure.AshtonC1 wrote:I must now identify problems caused by incorrect references like this:the project compiles, but won't Run.Code: Select all
db->Open(testDBName);
Regards,
Ulrich