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

Add spatialite arm64 linux path #600

Merged
merged 2 commits into from
Nov 4, 2023

Conversation

MikeCoats
Copy link
Contributor

@MikeCoats MikeCoats commented Nov 3, 2023

According to both Debian and Ubuntu, the correct “target triple” for arm64 is aarch64-linux-gnu, so we should be looking in /usr/lib/aarch64-linux-gnu for mod_spatialite.so.

I can confirm that on both of my Debian arm64 SBCs, libsqlite3-mod-spatialite installs to that path.

$ 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

This is a set of before and after snippets of pytest’s output for this PR.

Before

$ pytest
tests/test_get.py ......                                                 [ 73%]
tests/test_gis.py ssssssssssss                                           [ 75%]
tests/test_hypothesis.py ....                                            [ 75%]

After

$ pytest
tests/test_get.py ......                                                 [ 73%]
tests/test_gis.py ............                                           [ 75%]
tests/test_hypothesis.py ....                                            [ 75%]

Issue: #599


📚 Documentation preview 📚: https://sqlite-utils--600.org.readthedocs.build/en/600/

@simonw
Copy link
Owner

simonw commented Nov 4, 2023

Thanks for this!

Copy link

codecov bot commented Nov 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (622c3a5) 95.77% compared to head (b1a6076) 95.77%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #600   +/-   ##
=======================================
  Coverage   95.77%   95.77%           
=======================================
  Files           8        8           
  Lines        2840     2840           
=======================================
  Hits         2720     2720           
  Misses        120      120           
Files Coverage Δ
sqlite_utils/db.py 97.22% <ø> (ø)
sqlite_utils/utils.py 94.56% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simonw
Copy link
Owner

simonw commented Nov 4, 2023

The tests failed because they found a spelling mistake in a completely unrelated area of the code - not sure why that had not been caught before.

@simonw
Copy link
Owner

simonw commented Nov 4, 2023

Testing this manually on macOS using Docker Desk top like this:

docker run -it --rm arm64v8/ubuntu /bin/bash

Then inside the container:

uname -m

Outputs: aarch64

Then:

apt install spatialite-bin libsqlite3-mod-spatialite git python3 python3-venv -y
cd /tmp
git clone https://github.com/simonw/sqlite-utils
cd sqlite-utils
python3 -m venv venv
source venv/bin/activate
pip install -e '.[test]'
sqlite-utils memory "select spatialite_version()" --load-extension=spatialite

Which output:

Traceback (most recent call last):
  File "/tmp/sqlite-utils/venv/bin/sqlite-utils", line 33, in <module>
    sys.exit(load_entry_point('sqlite-utils', 'console_scripts', 'sqlite-utils')())
  File "/tmp/sqlite-utils/venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/tmp/sqlite-utils/venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/tmp/sqlite-utils/venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/tmp/sqlite-utils/venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmp/sqlite-utils/venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/tmp/sqlite-utils/sqlite_utils/cli.py", line 1959, in memory
    _load_extensions(db, load_extension)
  File "/tmp/sqlite-utils/sqlite_utils/cli.py", line 3232, in _load_extensions
    if ":" in ext:
TypeError: argument of type 'NoneType' is not iterable

Then I ran this:

git checkout -b MikeCoats-spatialite-paths-linux-arm main
git pull https://github.com/MikeCoats/sqlite-utils.git spatialite-paths-linux-arm

And now:

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

Outputs:

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

@simonw simonw merged commit b92ea47 into simonw:main Nov 4, 2023
34 checks passed
@simonw
Copy link
Owner

simonw commented Nov 4, 2023

The GIS tests now pass in that container too:

pytest tests/test_gis.py
======================== test session starts =========================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /tmp/sqlite-utils
plugins: hypothesis-6.88.1
collected 12 items                                                   

tests/test_gis.py ............                                 [100%]

========================= 12 passed in 0.48s =========================

simonw added a commit that referenced this pull request Nov 4, 2023
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

Successfully merging this pull request may close these issues.

2 participants