I ended up manually installing some packages (lowest dependency on top) from the Groovy Gorilla repos:
apt-get install -y --no-install-recommends wget \
proj-bin proj-data gdal-bin sqlite3 libgeos-dev librttopo-dev \
zlib1g libpq5 libc-bin libc6 libtiff-dev libsqlite3-dev libcurl4-openssl-dev \
&& wget -q http://archive.ubuntu.com/ubuntu/pool/universe/p/proj/proj-data_7.1.0-1_all.deb \
&& wget -q http://archive.ubuntu.com/ubuntu/pool/universe/p/proj/libproj19_7.1.0-1_amd64.deb \
&& wget -q http://archive.ubuntu.com/ubuntu/pool/universe/p/proj/libproj-dev_7.1.0-1_amd64.deb \
&& wget -q http://archive.ubuntu.com/ubuntu/pool/universe/s/spatialite/libspatialite7_5.0.0-1_amd64.deb \
&& wget -q http://archive.ubuntu.com/ubuntu/pool/universe/s/spatialite/libspatialite-dev_5.0.0-1_amd64.deb \
&& dpkg -i proj-data_7.1.0-1_all.deb \
&& dpkg -i libproj19_7.1.0-1_amd64.deb \
&& dpkg -i libproj-dev_7.1.0-1_amd64.deb \
&& dpkg -i libspatialite7_5.0.0-1_amd64.deb \
&& dpkg -i libspatialite-dev_5.0.0-1_amd64.deb \
&& rm --interactive=never proj-data_7.1.0-1_all.deb libproj19_7.1.0-1_amd64.deb \
libproj-dev_7.1.0-1_amd64.deb libspatialite7_5.0.0-1_amd64.deb libspatialite-dev_5.0.0-1_amd64.deb \
&& apt-get -y autoremove --purge && apt-get -y autoclean && ldconfig \
(yes, awful, but working).
My tests where these two function calls, especially the second one:
ogrinfo -dialect "SQLite" db.sqlite -sql "SELECT sqlite_version();"
ogrinfo -dialect "SQLite" db.sqlite -sql "SELECT spatialite_version();"
Which results in the following when using osgeo/gdal:ubuntu-full-3.2.1:
INFO: Open of `db.sqlite'
using driver `SQLite' successful.
Layer name: SELECT
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
sqlite_version(): String (0.0)
OGRFeature(SELECT):0
sqlite_version() (String) = 3.31.1
and
INFO: Open of `db.sqlite'
using driver `SQLite' successful.
Layer name: SELECT
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
spatialite_version(): String (0.0)
OGRFeature(SELECT):0
spatialite_version() (String) = 4.3.0a
respectively. And there, ST_MakeValid() was not known.
And it results the following with the workaround shown here above, and using osgeo/gdal:ubuntu-small-3.2.1 (~700MB lighter than the full version):
- 'VirtualXPath' [XML Path Language - XPath]
INFO: Open of `db.sqlite'
using driver `SQLite' successful.
Layer name: SELECT
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
sqlite_version(): String (0.0)
OGRFeature(SELECT):0
sqlite_version() (String) = 3.31.1
and
- 'VirtualXPath' [XML Path Language - XPath]
INFO: Open of `db.sqlite'
using driver `SQLite' successful.
Layer name: SELECT
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
spatialite_version(): String (0.0)
OGRFeature(SELECT):0
spatialite_version() (String) = 5.0.0
respectively. And there, ST_MakeValid() was actually available!
It seems these functions where not available with spatialite versions < 5.x. But I'm quite sure I'm wrong somewhere because on the doc, it's written version 4.2 and ST_MakeValid() was already there.
ST_MakeValid(geometry)which seems to be written as such in sqlite3 (https://i.stack.imgur.com/tWwAj.png http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html). And which still not available. – swiss_knight Feb 21 '21 at 00:19liblwgeomwas not much appreciated (don't know why) and people struggled compiling sqlite/spatialite withrttoposupport.... I will give thisaptpackage a try then! And will come back here. – swiss_knight Feb 21 '21 at 00:45librttopo-dev,librttopo1andlibsqlite3-mod-spatialitein order toload_extension('mod_spatialite');was not sufficient. I thought it would be. So, there is probably a moment, in between version 4.3 and version 5.0 where the sqlite3 (or gdal?) devs have incorporated the spatial functions in a more "native" way, I have no other explanations. I strangely but happily didn't not even have to actually load that spatialite module with the working solution I have shown in my answer; sqlite3 is naturally geo-aware in a way! Starting from Ubuntu 20.10. – swiss_knight Feb 21 '21 at 01:06ST_MakeValidby depending previously on LWGEOM instead of RTTOPO e.g the doc http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html and all your attempts failed... – ThomasG77 Feb 21 '21 at 01:15