Closed jerrygreen closed 1 year ago
I don't think this library works on aarch64 linux yet. But let us try anyway! The error you have posted simply means that you did not pass the --unstable
flag.
I do not have an actual aarch64 Linux machine to test on. But I will investigate this issue further over the weekend. I can probably natively virtualize Linux on Arm-based Mac.
Oh, my bad. Tried --unstable
flag and I now get two errors, same and new one:
deno run -A --unstable test.ts
error: Uncaught (in promise) Error: Failed to load SQLite3 Dynamic Library
throw new Error("Failed to load SQLite3 Dynamic Library", { cause: e });
^
at https://deno.land/x/sqlite3@0.9.1/src/ffi.ts:618:9
at eventLoopTick (ext:core/01_core.js:183:11)
Caused by: Error: Could not open library: Could not open library: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/ubuntu/.cache/deno/plug/https/github.com/3cb5e608efce656445a255c1ab6f4d25155f9e25e344dc43ab8a196786e951cf.so)
at new DynamicLibrary (ext:deno_ffi/00_ffi.js:440:46)
at Object.dlopen (ext:deno_ffi/00_ffi.js:577:10)
at dlopen (https://deno.land/x/plug@1.0.1/mod.ts:155:15)
at eventLoopTick (ext:core/01_core.js:183:11)
at async https://deno.land/x/sqlite3@0.9.1/src/ffi.ts:601:7
Maybe if I update glibc, it will be solved, but... Is this an absolute necessity? I mean, I have Ubuntu 20.04.2 LTS
installed, it's not that old... And granularly updating glibc would be pain in the ass and practically not very healthy for the OS in overall, I guess... Kinda fundamental dependency.
ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
I tried older versions of deno-sqlite3, but they don't work it seems: it's trying to download libsqlite3_aarch64.so
but they're present only in the recent releases, 0.9.0
and 0.9.1
, – both same error.
What do you think? Updating glibc, or an OS, – the only right way forward?
Do you have sqlite installed on your system? You can try using the default sqlite. To do that, set DENO_SQLITE_PATH to full path to the library file present on your system.
Yes, sqlite3 is installed:
sqlite3 --version
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt1
If I set path explicitly, the error is a bit different but still there:
DENO_SQLITE_PATH=/usr/bin/sqlite3 deno run -A --unstable test.ts
error: Uncaught Error: Failed to load SQLite3 Dynamic Library
throw new Error("Failed to load SQLite3 Dynamic Library", { cause: e });
^
at https://deno.land/x/sqlite3@0.9.1/src/ffi.ts:618:9
Caused by: Error: Could not open library: Could not open library: /usr/bin/sqlite3: cannot dynamically load position-independent executable
at new DynamicLibrary (ext:deno_ffi/00_ffi.js:440:46)
at Object.dlopen (ext:deno_ffi/00_ffi.js:577:10)
at https://deno.land/x/sqlite3@0.9.1/src/ffi.ts:598:16
I might be wrong, but this new error, /usr/bin/sqlite3: cannot dynamically load position-independent executable
, seems to be related to same glibc, so it's probably the same issue, just told in two different ways by some reason. I also tried just sqlite
(not sqlite3), – which leaves the same error.
Is it possible to set custom path for glibc? I think if glibc is, truly, the only reason, then this workaround would be enough for me. At least it would simplify debugging, as I don't have to replace my system-level glibc.
You need to point the path to sqlite3 shared library not the binary. It would look like libsqlite3.so.
Hooray, it works! Thanks.
I'd add some details to whatever people coming here after. I first found several .so
files:
2>/dev/null find / -name libsqlite3.so
/snap/gnome-3-38-2004/145/usr/lib/aarch64-linux-gnu/libsqlite3.so
/snap/gnome-3-38-2004/141/usr/lib/aarch64-linux-gnu/libsqlite3.so
/snap/gnome-42-2204/122/usr/lib/aarch64-linux-gnu/libsqlite3.so
/snap/gnome-42-2204/112/usr/lib/aarch64-linux-gnu/libsqlite3.so
/snap/lxd/23999/lib/libsqlite3.so
/snap/lxd/24065/lib/libsqlite3.so
I tried them all, some of them returned errors just like in already mentioned issue:
DENO_SQLITE_PATH=/snap/lxd/24065/lib/libsqlite3.so deno run -A --unstable test.ts
Segmentation fault (core dumped)
Some returned the same Failed to load SQLite3 Dynamic Library
error:
DENO_SQLITE_PATH=/snap/gnome-42-2204/112/usr/lib/aarch64-linux-gnu/libsqlite3.so deno run -A --unstable test.ts
error: Uncaught Error: Failed to load SQLite3 Dynamic Library
throw new Error("Failed to load SQLite3 Dynamic Library", { cause: e });
^
at https://deno.land/x/sqlite3@0.9.1/src/ffi.ts:618:9
Caused by: Error: Could not open library: Could not open library: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /snap/gnome-42-2204/112/usr/lib/aarch64-linux-gnu/libsqlite3.so)
at new DynamicLibrary (ext:deno_ffi/00_ffi.js:440:46)
at Object.dlopen (ext:deno_ffi/00_ffi.js:577:10)
at https://deno.land/x/sqlite3@0.9.1/src/ffi.ts:598:16
✅ And with one, deno actually executed example code without errors, correctly logging sqlite version:
DENO_SQLITE_PATH=/snap/gnome-3-38-2004/145/usr/lib/aarch64-linux-gnu/libsqlite3.so deno run -A --unstable test.ts
3.41.2
Weirdly though, it shows different version than sqlite3 --version
:
sqlite3 --version
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt1
So I guess I have several sqlite3 installed and some of them don't work, including this one used by default.
I'm trying to run this code sample from readme:
And I'm getting this error:
It might be somehow related to this:
I think of this relation because I'm also using aarch64 / Raspberry Pi. But it's another error so idk.
Version info:
I already used dozens of other deno packages, they work perfectly fine.