wxSQLIte3 from sources...

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
dkaip
I live to help wx-kind
I live to help wx-kind
Posts: 171
Joined: Wed Jan 20, 2010 1:15 pm

wxSQLIte3 from sources...

Postby dkaip » Fri Jan 26, 2018 7:29 pm

Hello, very thanks for lib.
I am trying to compile minimal with only source files , so i post a piece of source CodeBlocks file, because compiler says ..
...wxsqlite3-3.5.9/src/wxsqlite3.cpp|1329|undefined reference to `sqlite3_column_database_name'


But there is at "sqlite3.h"

Code: Select all

<Compiler>
<Add option="-Wall" />
<Add option="-std=c++14" />
<Add option="`/home/a/wxWidgets-3.0.3/gtk-build/wx-config --cflags`" />
<Add directory="/home/a/wxsqlite3-3.5.9/include" />
<Add directory="/home/a/wxsqlite3-3.5.9/sqlite-amalgamation-3220000" />
<Add directory="/home/a/wxsqlite3-3.5.9/sqlite3/secure/src" />
</Compiler>
<Linker>
<Add option="`/home/a/wxWidgets-3.0.3/gtk-build/wx-config  --libs all`" />
</Linker>
<Unit filename="include/wx/wxsqlite3.h" />
<Unit filename="include/wx/wxsqlite3_version.h" />
<Unit filename="include/wx/wxsqlite3def.h" />
<Unit filename="include/wx/wxsqlite3dyn.h" />
<Unit filename="include/wx/wxsqlite3opt.h" />
<Unit filename="samples/minimal.cpp" />
<Unit filename="sqlite-amalgamation-3220000/sqlite3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="sqlite-amalgamation-3220000/sqlite3.h" />
<Unit filename="sqlite-amalgamation-3220000/sqlite3ext.h" />
<Unit filename="src/wxsqlite3.cpp" />


Linux Mint, Gcc, CodeBlocks.

User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 422
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxSQLIte3 from sources...

Postby xaviou » Fri Jan 26, 2018 10:22 pm

Hi.

When you get a "undefined reference to ...." error, it generaly comes from the linker.
And it generaly means you forgot a lib (or, in case you use gcc, your libs are not in the correct order)

In your case, it seems you didn't add the wxsqlite lib to your linker options.

Do it, and it should solve your problem.

Regards
Xav'
My wxWidgets stuff web page : X@v's wxStuff

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

Re: wxSQLIte3 from sources...

Postby utelle » Sat Jan 27, 2018 12:45 pm

dkaip wrote:Hello, very thanks for lib.
I am trying to compile minimal with only source files , so i post a piece of source CodeBlocks file, because compiler says ..
...wxsqlite3-3.5.9/src/wxsqlite3.cpp|1329|undefined reference to `sqlite3_column_database_name'


But there is at "sqlite3.h"

Code: Select all

<Compiler>
<Add option="-Wall" />
<Add option="-std=c++14" />
<Add option="`/home/a/wxWidgets-3.0.3/gtk-build/wx-config --cflags`" />
<Add directory="/home/a/wxsqlite3-3.5.9/include" />
<Add directory="/home/a/wxsqlite3-3.5.9/sqlite-amalgamation-3220000" />
<Add directory="/home/a/wxsqlite3-3.5.9/sqlite3/secure/src" />
</Compiler>
<Linker>
<Add option="`/home/a/wxWidgets-3.0.3/gtk-build/wx-config  --libs all`" />
</Linker>
<Unit filename="include/wx/wxsqlite3.h" />
<Unit filename="include/wx/wxsqlite3_version.h" />
<Unit filename="include/wx/wxsqlite3def.h" />
<Unit filename="include/wx/wxsqlite3dyn.h" />
<Unit filename="include/wx/wxsqlite3opt.h" />
<Unit filename="samples/minimal.cpp" />
<Unit filename="sqlite-amalgamation-3220000/sqlite3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="sqlite-amalgamation-3220000/sqlite3.h" />
<Unit filename="sqlite-amalgamation-3220000/sqlite3ext.h" />
<Unit filename="src/wxsqlite3.cpp" />


Linux Mint, Gcc, CodeBlocks.

The wxSQLite3 distribution is self-contained. That is, you don't need to download the SQLite sources separately; they are included in subfolder sqlite3/secure/src of the wxSQLite3 distribution. No need for sqlite-amalgamation-3220000. (And usually wxSQLite3 is updated shortly after a release of a new SQLite3 version.)

There are several compile time options required to compile SQLite3 and wxSQLite3, some of them have to match, so that you don't get conflicts. For example, the option WXSQLITE3_HAVE_METADATA is enabled by default (see include/wx/wxsqlite3opt.h). However, this option requires that SQLite3 is compiled with the option SQLITE_ENABLE_COLUMN_METADATA. In your Code::Blocks project file I see no trace of any compile time options ... and this means you are seeking for trouble ... as you experienced.

Regards,

Ulrich

dkaip
I live to help wx-kind
I live to help wx-kind
Posts: 171
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxSQLIte3 from sources...

Postby dkaip » Sun Feb 04, 2018 6:09 pm

Thank you very match for instructions. I am just find some time to see it.
I hope to find a litle time to try.
Thank's
Jim.

dkaip
I live to help wx-kind
I live to help wx-kind
Posts: 171
Joined: Wed Jan 20, 2010 1:15 pm

Re: wxSQLIte3 from sources...

Postby dkaip » Sun Jul 22, 2018 2:38 pm

Hello, now i have some time to try wxSqlite3 from sources.
I am taking an error in try to compile minimal in Linux Mint...

/home/a/repo/wxsqlite3/sqlite3secure/src/chacha20poly1305.c|85|error: unknown type name ‘size_t’|


I am sending the source code from CodeBlocks source file.
I have put the options ...

<Add option="-DSQLITE_ENABLE_COLUMN_METADATA" />
<Add option="-DWXSQLITE3_HAVE_METADATA" />

Thank you
Jim.

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
   <FileVersion major="1" minor="6" />
   <Project>
      <Option title="2" />
      <Option pch_mode="2" />
      <Option compiler="gcc" />
      <Build>
         <Target title="Debug">
            <Option output="bin/Debug/1" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj/Debug/" />
            <Option type="0" />
            <Option compiler="gcc" />
            <Option projectLinkerOptionsRelation="2" />
            <Compiler>
               <Add option="-std=c++14" />
               <Add option="-g" />
            </Compiler>
         </Target>
         <Target title="Release">
            <Option output="bin/Release/1" prefix_auto="1" extension_auto="1" />
            <Option object_output="obj/Release/" />
            <Option type="0" />
            <Option compiler="gcc" />
            <Option projectLinkerOptionsRelation="2" />
            <Compiler>
               <Add option="-O2" />
            </Compiler>
            <Linker>
               <Add option="-s" />
            </Linker>
         </Target>
      </Build>
      <Compiler>
         <Add option="-Wall" />
         <Add option="-std=c++14" />
         <Add option="`wx-config --cflags`" />
         <Add option="-DSQLITE_ENABLE_COLUMN_METADATA" />
         <Add option="-DWXSQLITE3_HAVE_METADATA" />
         <Add directory="../wxsqlite3" />
         <Add directory="../wxsqlite3/src" />
         <Add directory="../wxsqlite3/include" />
      </Compiler>
      <Linker>
         <Add option="`wx-config --libs`" />
      </Linker>
      <Unit filename="../wxsqlite3/include/wx/wxsqlite3.h" />
      <Unit filename="../wxsqlite3/include/wx/wxsqlite3_version.h" />
      <Unit filename="../wxsqlite3/include/wx/wxsqlite3def.h" />
      <Unit filename="../wxsqlite3/include/wx/wxsqlite3dyn.h" />
      <Unit filename="../wxsqlite3/include/wx/wxsqlite3opt.h" />
      <Unit filename="../wxsqlite3/samples/minimal.cpp" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/carray.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/chacha20poly1305.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/codec.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/codec.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/codecext.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/csv.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/extensionfunctions.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/fastpbkdf2.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/fastpbkdf2.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/fileio.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/md5.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/regexp.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/rekeyvacuum.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/rijndael.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/rijndael.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/series.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/sha1.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/sha1.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/sha2.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/sha2.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/shathree.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/shell.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3.rc" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3ext.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3secure.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3secure.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/sqlite3userauth.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/test_windirent.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/sqlite3secure/src/test_windirent.h" />
      <Unit filename="../wxsqlite3/sqlite3secure/src/userauth.c">
         <Option compilerVar="CC" />
      </Unit>
      <Unit filename="../wxsqlite3/src/wxsqlite3.cpp" />
      <Extensions>
         <envvars />
         <code_completion />
         <lib_finder disable_auto="1" />
         <debugger />
      </Extensions>
   </Project>
</CodeBlocks_project_file>

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

Re: wxSQLIte3 from sources...

Postby utelle » Sun Jul 22, 2018 7:04 pm

dkaip wrote:Hello, now i have some time to try wxSqlite3 from sources.
I am taking an error in try to compile minimal in Linux Mint...
/home/a/repo/wxsqlite3/sqlite3secure/src/chacha20poly1305.c|85|error: unknown type name ‘size_t’|

Obviously you try to compile the source files in wxsqlite3/sqlite3secure/src separately. This is not how it works.

The only file from directory wxsqlite3/sqlite3secure/src you have to compile is sqlite3secure.c. This file automatically includes all other required source files. The current version 4.0.4 of wxSQLite3 defines the following symbols as default:

Code: Select all

    THREADSAFE=1
    SQLITE_MAX_ATTACHED=10
    SQLITE_SOUNDEX
    SQLITE_ENABLE_COLUMN_METADATA
    SQLITE_HAS_CODEC=1
    CODEC_TYPE=CODEC_TYPE_CHACHA20
    SQLITE_SECURE_DELETE
    SQLITE_ENABLE_FTS3
    SQLITE_ENABLE_FTS3_PARENTHESIS
    SQLITE_ENABLE_FTS4
    SQLITE_ENABLE_FTS5
    SQLITE_ENABLE_JSON1
    SQLITE_ENABLE_RTREE
    SQLITE_CORE
    SQLITE_ENABLE_EXTFUNC
    SQLITE_ENABLE_CSV
    SQLITE_ENABLE_SHA3
    SQLITE_ENABLE_CARRAY
    SQLITE_ENABLE_FILEIO
    SQLITE_ENABLE_SERIES
    SQLITE_TEMP_STORE=2
    SQLITE_USE_URI
    SQLITE_USER_AUTHENTICATION

And for the wxWidgets wrapper the following defines are used:

Code: Select all

    wxUSE_DYNAMIC_SQLITE3_LOAD=0
    WXSQLITE3_HAVE_METADATA=1
    WXSQLITE3_USER_AUTHENTICATION=1
    WXSQLITE3_HAVE_CODEC=1
    WXSQLITE3_HAVE_LOAD_EXTENSION=0

Good luck!

Regards,

Ulrich


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 2 guests