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 cannot load extension: undefined symbol: sqlite3_limit #372

Open
itviewer opened this issue Mar 2, 2023 · 2 comments
Open

sqlite cannot load extension: undefined symbol: sqlite3_limit #372

itviewer opened this issue Mar 2, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@itviewer
Copy link

itviewer commented Mar 2, 2023

ubuntu 22.04.2

$ sqlite3 
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .load ./libmergestat
Error: ./libmergestat.so: undefined symbol: sqlite3_limit
sqlite>
@riyaz-ali
Copy link
Contributor

Thanks for reporting the issue @itviewer. I was able to reproduce it on Ubuntu 22.04.1

For future reference, one can either:

  • download the sqlite3 package from apt (I used the one in jammy-updates repository), or
  • build sqlite3 locally using gcc
    gcc -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTEE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DHAVE_USLEEP -DHAVE_READLINE -I. -Os shell.c sqlite3.c -lpthread -ldl -lm -lreadline -lncurses -o sqlite3

Output from nm on the generated sqlite3 binary shows that sqlite3_limit() symbol is actually defined:
image

@patrickdevivo @amenowanna let's try this out on couple more linux / ubuntu versions (MacOS builds works fine)

@riyaz-ali riyaz-ali self-assigned this Mar 3, 2023
@riyaz-ali riyaz-ali added the bug Something isn't working label Mar 3, 2023
@sabbaticas
Copy link

sabbaticas commented Jun 1, 2023

Hi,

The mergestat binary works with no issues. However, I am having the same error message undefined symbol: sqlite3_limit

The current configuration is:
Docker ubuntu image running on a x86 mac mini venture 13.3.1 (a)
Within a docker shell:
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

I have compiled sqilte3 using your command above and using source from the following zip
https://www.sqlite.org/2023/sqlite-amalgamation-3420000.zip

running .version provides
sqlite> .version
SQLite 3.42.0 2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0
gcc-11.3.0

sqlite> .load ./libmergestat
Error: ./libmergestat.so: undefined symbol: sqlite3_limit

Running your nm command
root@617ebbf30e09:/data/sqlite# nm -C ./sqlite3 | grep sqlite3_limit
000000000002c8f2 T sqlite3_limit

Initially, I tried .load with the latest v0.6.1 version of libmergestat.so
I tried previous versions until I found that v0.5.10 would load successfully.

I tested this version (v0.5.10) with both the compiled version as well as the base SQLite installed using apt and it loads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants