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

Cannot find spatialite on arm64 linux #599

Closed
MikeCoats opened this issue Nov 3, 2023 · 1 comment
Closed

Cannot find spatialite on arm64 linux #599

MikeCoats opened this issue Nov 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@MikeCoats
Copy link
Contributor

Initially, I found an issue in datasette where it wouldn’t find spatialite when running on my Radxa Rock 5B - an RK3588 powered SBC, running the arm64 build of Debian Bullseye. I confirmed the same behaviour on my Raspberry Pi 4 - a BCM2711 powered SBC, running the arm64 build of Debian Bookworm.

$ datasette --load-extension=spatialite example.db
Error: Could not find SpatiaLite extension

I did some digging and realised the issue originates in this project. Even with the libsqlite3-mod-spatialite package installed, pytest skips all of the GIS tests in the project.

$ apt list --installed | grep spatial
[…]
libsqlite3-mod-spatialite/stable,now 5.0.1-3 arm64 [installed]

$ ls -l /usr/lib/*/*spatial*
lrwxrwxrwx 1 root root      23 Dec  1  2022 /usr/lib/aarch64-linux-gnu/mod_spatialite.so -> mod_spatialite.so.7.1.0
lrwxrwxrwx 1 root root      23 Dec  1  2022 /usr/lib/aarch64-linux-gnu/mod_spatialite.so.7 -> mod_spatialite.so.7.1.0
-rw-r--r-- 1 root root 7348584 Dec  1  2022 /usr/lib/aarch64-linux-gnu/mod_spatialite.so.7.1.0
$ pytest
tests/test_get.py ......                                                 [ 73%]
tests/test_gis.py ssssssssssss                                           [ 75%]
tests/test_hypothesis.py ....                                            [ 75%]

I tracked the issue down to the find_sqlite() function in the utils.py file. The SPATIALITE_PATHS array doesn’t have an entry for the location of this module on arm64 linux.

MikeCoats added a commit to MikeCoats/sqlite-utils that referenced this issue Nov 3, 2023
simonw pushed a commit that referenced this issue Nov 4, 2023
@simonw
Copy link
Owner

simonw commented Nov 4, 2023

See details of how I tested this here:

Short version: having applied this fix, the following command (on simulated aarch64):

sqlite-utils memory "select spatialite_version()" --load-extension=spatialite

Outputs:

[{"spatialite_version()": "5.0.1"}]

@simonw simonw closed this as completed Nov 4, 2023
simonw added a commit that referenced this issue Nov 4, 2023
@simonw simonw added the bug Something isn't working label Nov 4, 2023
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

2 participants