utelle / wxsqlite3

wxSQLite3 - SQLite3 database wrapper for wxWidgets (including SQLite3 encryption extension)
http://utelle.github.io/wxsqlite3
Other
598 stars 181 forks source link

sqlite3secure warnings on linux #1

Closed dmgawel closed 8 years ago

dmgawel commented 8 years ago

When building moneymanagerex which uses wxsqlite3 with secure and extension functions on Linux I got following errors:

/home/dawid/Development/mmex/build/bk-deps g++ -c -o wxsqlite_wxsqlite3.o -DNOPCH -DSQLITE_CORE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_EXTFUNC -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_JSON1 -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH -DHAVE_ISBLANK -DWXSQLITE3_HAVE_CODEC -DWXSQLITE3_HAVE_METADATA -DWXSQLITE3_USER_AUTHENTICATION -I../lib/wxsqlite3/sqlite3/secure/src -I../lib/wxsqlite3/include -fPIC -DPIC -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  -g -O2 -std=c++11 -g0 -O2 ../lib/wxsqlite3/src/wxsqlite3.cpp
/home/dawid/Development/mmex/build/bk-deps gcc -c -o wxsqlite_sqlite3secure.o -DNOPCH -DSQLITE_CORE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_EXTFUNC -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_JSON1 -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH -DHAVE_ISBLANK -DWXSQLITE3_HAVE_CODEC -DWXSQLITE3_HAVE_METADATA -DWXSQLITE3_USER_AUTHENTICATION -I../lib/wxsqlite3/sqlite3/secure/src -I../lib/wxsqlite3/include -fPIC -DPIC -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  -g -O2 -g0 -O2 ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:68:0:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:213:25: error: conflicting types for ‘i64’
 typedef int64_t         i64;
                         ^
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:13:0:
../lib/wxsqlite3/sqlite3/secure/src/sqlite3.c:9627:22: note: previous declaration of ‘i64’ was here
 typedef sqlite_int64 i64;          /* 8-byte signed integer */
                      ^
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:68:0:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c: In function ‘print_elem’:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:1966:3: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ [-Wformat=]
   printf("%d => %lld\n", ee,c);
   ^
make: *** [wxsqlite_sqlite3secure.o] Error 1

It looks wxsqlite3 related.

g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3

utelle commented 8 years ago

This seems to be an issue of the "extension functions" module. Could you please comment out lines 211 and 213 in file extensionfunctions.c like line 212 and check whether this solves the issue? Thanks.

dmgawel commented 8 years ago

Kinda helped. Project now builds (which is great) but some warnings are still there. I'm not sure if I should make PR with your suggestion or you want to dig deeper?

/home/dawid/Development/mmex/build/bk-deps g++ -c -o wxsqlite_wxsqlite3.o -DNOPCH -DSQLITE_CORE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_EXTFUNC -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_JSON1 -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH -DHAVE_ISBLANK -DWXSQLITE3_HAVE_CODEC -DWXSQLITE3_HAVE_METADATA -DWXSQLITE3_USER_AUTHENTICATION -I../lib/wxsqlite3/sqlite3/secure/src -I../lib/wxsqlite3/include -fPIC -DPIC -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  -g -O2 -std=c++11 -g0 -O2 ../lib/wxsqlite3/src/wxsqlite3.cpp
/home/dawid/Development/mmex/build/bk-deps gcc -c -o wxsqlite_sqlite3secure.o -DNOPCH -DSQLITE_CORE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_EXTFUNC -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_JSON1 -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH -DHAVE_ISBLANK -DWXSQLITE3_HAVE_CODEC -DWXSQLITE3_HAVE_METADATA -DWXSQLITE3_USER_AUTHENTICATION -I../lib/wxsqlite3/sqlite3/secure/src -I../lib/wxsqlite3/include -fPIC -DPIC -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  -g -O2 -g0 -O2 ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:68:0:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c: In function ‘modeFinalize’:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:1545:23: warning: passing argument 2 of ‘map_iterate’ from incompatible pointer type
     map_iterate(p->m, modeIterate, p);
                       ^
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:190:6: note: expected ‘map_iterator’ but argument is of type ‘void (*)(void *, i64,  void *)’
 void map_iterate(map *m, map_iterator iter, void* p);
      ^
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c: In function ‘_medianFinalize’:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:1566:23: warning: passing argument 2 of ‘map_iterate’ from incompatible pointer type
     map_iterate(p->m, medianIterate, p);
                       ^
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:190:6: note: expected ‘map_iterator’ but argument is of type ‘void (*)(void *, i64,  void *)’
 void map_iterate(map *m, map_iterator iter, void* p);
      ^
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c: In function ‘print_elem’:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:1966:3: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ [-Wformat=]
   printf("%d => %lld\n", ee,c);
   ^
rm -f libwxsqlite.a
ar rcu libwxsqlite.a wxsqlite_wxsqlite3.o wxsqlite_sqlite3secure.o
ranlib libwxsqlite.a
utelle commented 8 years ago

I made a few modifications to the source code of the extension functions that hopefully solve the issue.

Please check whether there are still warning messages issued. If yes, please let me know.

dmgawel commented 8 years ago

Works perfect! No warnings. Thank you.