geopaparazzi / libjsqlite-spatialite-android

Project to create the libjsqlite.so used in geopaparazzi
75 stars 24 forks source link

Compile mod_spatialite for android #18

Closed Bezzu closed 6 years ago

Bezzu commented 6 years ago

Hi, I want to load spatialite library (version 4.5.0) as a sqlite module extension. I try to compile the spatialite library and its dependency with the configure option --enable-mod-only, but when I load it, I have the following error: undefined symbol: sqlite3_spatialite_init (code 1) ################################################################# Error Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing database. (undefined symbol: sqlite3_spatialite_init (code 1)) ################################################################# It seem that the spatialite library isn't compiled as a module but as normal shared library. Is it possible to build spatialite library as a loadable module for android?

Version library compiled:

Thanks in advanced. Bezzu

mj10777 commented 6 years ago

Android normally does not support dynamic or module libraries.

If you have compiled this yourself, then you must use 'SELECT load_extension('mod_spatialite');' from inside a sqlite3 connection.

see: https://www.gaia-gis.it/fossil/libspatialite/wiki?name=mod_spatialite

Bezzu commented 6 years ago

Hi, I use a cipher sqlite3 android library that enables loading extension and I already load spatialite as a extension module using the sql command:
SELECT load_extension('mod_spatialite'); The loading of the module is failed catching the above error. On internet I have found that this error is caused by loading the spatialite share library version instead of the module version. How can I compile the spatialite library as a module?

Thanks in advanced. Bezzu

mj10777 commented 6 years ago

Normally when building spatialite you should have

The last is what you want (mod_spatialite.so) So you should check to see if you have that.

--enable-share=false // build shared libraries [default=yes] could possibly avoid the building of libspatialite.so


As far as I can see, mod_spatialite.so is always built

Otherwise ask at: https://groups.google.com/forum/#!forum/spatialite-users

where Sandro will could tell you more.