Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite 3.32.3 build issues #38

Closed
AdamSLevy opened this issue Jun 27, 2020 · 3 comments
Closed

SQLite 3.32.3 build issues #38

AdamSLevy opened this issue Jun 27, 2020 · 3 comments

Comments

@AdamSLevy
Copy link

AdamSLevy commented Jun 27, 2020

I downloaded the latest SQLite amalgamation and dropped those files in the root of the repo.

I committed them and then ran the following:

$ ./script/rekeyvacuum.sh > rekeyvacuum.c 
$ ./script/release.sh 
[+] SQLite version 3.32.3
[+] Checking rekeyvacuum.c
[+] Creating release directory sqleet-v0.32.3
[+] Generating sqleet.c amalgamation
[+] Generating sqleet.h amalgamation
[+] Updating shell.c #include "sqlite3.h" -> "sqleet.h"
[+] Copying sqlite3ext.h to release directory
[+] Creating release archives
[+] Success!
git tag v0.32.3 && git push origin v0.32.3

When I go to build I receive many compilation errors:

$ cd sqleet-v0.32.3/
$ ls
README.md  shell.c  sqleet.c  sqleet.h  sqlite3ext.h
$ cc ./sqleet.c 
./sqleet.c: In function ‘codec_set_to’:
./sqleet.c:231095:9: warning: implicit declaration of function ‘sqlite3PagerSetCodec’; did you mean ‘sqlite3PagerSetFlags’? [-Wimplicit-function-declaration]
231095 |         sqlite3PagerSetCodec(pager, codec_handle, size_hook, codec_free, codec);
       |         ^~~~~~~~~~~~~~~~~~~~
       |         sqlite3PagerSetFlags
./sqleet.c: In function ‘sqlite3CodecGetKey’:
./sqleet.c:231156:20: warning: implicit declaration of function ‘sqlite3PagerGetCodec’; did you mean ‘sqlite3PagerGetExtra’? [-Wimplicit-function-declaration]
231156 |     Codec *codec = sqlite3PagerGetCodec(sqlite3BtreePager(db->aDb[nDb].pBt));
       |                    ^~~~~~~~~~~~~~~~~~~~
       |                    sqlite3PagerGetExtra
./sqleet.c:231156:20: warning: initialization of ‘Codec *’ {aka ‘struct codec *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
./sqleet.c: In function ‘sqlite3CodecAttach’:
./sqleet.c:231191:15: warning: assignment to ‘Codec *’ {aka ‘struct codec *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
231191 |         codec = sqlite3PagerGetCodec(sqlite3BtreePager(db->aDb[mDb].pBt));
       |               ^
./sqleet.c: In function ‘sqlite3_rekey_v2’:
./sqleet.c:231249:12: warning: assignment to ‘Codec *’ {aka ‘struct codec *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
231249 |     reader = sqlite3PagerGetCodec(pager);
       |            ^
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../lib/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `pthreadMutexAlloc':
sqleet.c:(.text+0x4499): undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: sqleet.c:(.text+0x44aa): undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: sqleet.c:(.text+0x44c9): undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `pthreadMutexTry':
sqleet.c:(.text+0x4592): undefined reference to `pthread_mutex_trylock'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `sqlite3ThreadCreate':
sqleet.c:(.text+0x9284): undefined reference to `pthread_create'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `sqlite3ThreadJoin':
sqleet.c:(.text+0x9316): undefined reference to `pthread_join'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `unixDlOpen':
sqleet.c:(.text+0x11a42): undefined reference to `dlopen'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `unixDlError':
sqleet.c:(.text+0x11a61): undefined reference to `dlerror'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `unixDlSym':
sqleet.c:(.text+0x11ab0): undefined reference to `dlsym'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `unixDlClose':
sqleet.c:(.text+0x11ae6): undefined reference to `dlclose'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `codec_set_to':
sqleet.c:(.text+0xccd47): undefined reference to `sqlite3PagerSetCodec'
/usr/bin/ld: sqleet.c:(.text+0xccd6f): undefined reference to `sqlite3PagerSetCodec'
/usr/bin/ld: sqleet.c:(.text+0xccf46): undefined reference to `sqlite3PagerSetCodec'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `sqlite3CodecGetKey':
sqleet.c:(.text+0xcd003): undefined reference to `sqlite3PagerGetCodec'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `sqlite3CodecAttach':
sqleet.c:(.text+0xcd1a6): undefined reference to `sqlite3PagerGetCodec'
/usr/bin/ld: /tmp/cckYon8Q.o: in function `sqlite3_rekey_v2':
sqleet.c:(.text+0xcd3e0): undefined reference to `sqlite3PagerGetCodec'
/usr/bin/ld: sqleet.c:(.text+0xcd5cc): undefined reference to `sqlite3PagerSetCodec'
collect2: error: ld returned 1 exit status
@AdamSLevy
Copy link
Author

It appears the current approach to interfacing with sqlite3 is not going to work going forward past 3.32.0.

https://sqlite.org/forum/forumpost/08481b3fac

@utelle
Copy link
Contributor

utelle commented Jun 27, 2020

It appears the current approach to interfacing with sqlite3 is not going to work going forward past 3.32.0.

Yes, that is correct. On Feb 7, 2020 serious changes were applied to the SQLite sources (see SQLite timeline: “Simplify the code by removing the unsupported and undocumented SQLITE_HAS_CODEC compile-time option”). SQLite 3.32.0 and later are affected by this change. The SQLITE_HAS_CODEC API, on which the current implementation of SQLeet is based, is gone forever, unfortunately.

However, I started a new project, SQLite3MultipleCiphers, which adds encryption support to SQLite 3.32.0 and later using a new implementation based on SQLite's Virtual File System API. Supported ciphers are SQLCipher (all versions from 1 up to 4), SQLeet, System.Data.SQLite, and wxSQLite3.

@resilar
Copy link
Owner

resilar commented Dec 25, 2020

See #39 for discussion about VFS-based rewrite of sqleet.

@resilar resilar closed this as completed Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants