Spatialite for iOS : Functions in modules other than base doesn't work

71 views
Skip to first unread message

Jimmy

unread,
Apr 30, 2024, 6:43:03 AMApr 30
to SpatiaLite Users
Hey,

I am trying to run spatialite on iOS by using the following repo.
https://github.com/gstf/libspatialite-ios (outdated)
https://github.com/iulian0512/libspatialite-ios (has spatialite 5.1.0)

I am able to compile successfully and link the static libraries to my Swift project after following the instructions mentioned here https://gist.github.com/aaronpk/0252426d5161bc9650d8

Now when I try to run any spatialite query containing functions from base module, I get the correct result. But it fails when I do so with functions from say GEOS module.
Example -
SELECT ST_Distance(ST_GeomFromText('POINT(1 1)'), ST_GeomFromText('POINT(10 9)')) as result;   // returns 0 or garbage value

On spatialite initialisation, I get the following output.
Screenshot 2024-04-30 at 3.53.25 PM.png

a.fu...@lqt.it

unread,
May 1, 2024, 3:02:02 AMMay 1
to spatiali...@googlegroups.com
On Tue, 30 Apr 2024 03:29:16 -0700 (PDT), Jimmy wrote:
> Now when I try to run any spatialite query containing functions from
> base module, I get the correct result. But it fails when I do so with
> functions from say GEOS module.
>

Hi Jimmy,

from what you report it seems quite clear to me that the problem lies
entirely within the GEOS library, which was probably compiled
incorrectly or in any case in such a way not compatible with the
ARM64 architecture.

I suggest you ask for assistance on the GEOS mailing list
asking if they are aware of possible problems on
ARM64 platforms.

bye Sandro

Jimmy

unread,
May 1, 2024, 5:25:27 AMMay 1
to SpatiaLite Users
Hi Sandro,

Thanks for the response.
Actually, its not just GEOS but none of the other modules (PROJ, RTTOPO, etc.) are working, apart from base module functions.
https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.1.0.html

I came across this https://github.com/iulian0512/libspatialite-ios shared by one of the user in this group, thanks Iulian, which is supported on arm64 and other architectures. Although, I have managed to compile it successfully, it appears that there might be something I'm overlooking, preventing spatialite from communicating with other libraries.

Could you please guide me to any resource on how to use spatialite on iOS, if possible?

Thanks.

a.fu...@lqt.it

unread,
May 2, 2024, 4:14:52 AMMay 2
to spatiali...@googlegroups.com
On Wed, 1 May 2024 00:26:41 -0700 (PDT), Jimmy wrote:
> Hi Sandro,
>
> Thanks for the response.
> Actually, its not just GEOS but none of the other modules (PROJ,
> RTTOPO, etc.) are working, apart from base module functions.
> https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.1.0.html [1]
> [2] shared by one of the user in this group, thanks Iulian, which is
> supported on arm64 and other architectures. Although, I have managed
> to compile it successfully, it appears that there might be something
> I'm overlooking, preventing spatialite from communicating with other
> libraries.
>
> Could you please guide me to any resource on how to use spatialite on
> iOS, if possible?
>

Hi Jimmy,

'm very sorry but I can't help you because I've never worked
on iOS or ARM64, my personal experience just covers Linux
and Windows, I really don't know what to tell you.

just out of curiosity, did you personally compile all the
libraries using the same compiler (and the same options)
or are you trying to put together binary stuff from the
most disparate origins?

in this case it could be that using different conventions
for function calls causes chaos, although honestly I would
rather expect some crashes or fatal errors.

bye Sandro
Reply all
Reply to author
Forward
0 new messages