[gdal-dev] Building with support for VirtualOGR

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Building with support for VirtualOGR

René Hansen
Hi all,


As the subject reveals, I'm trying to compile with SQLite support, so I can load libgdal.so as an extension, as per the example on http://gdal.org/drv_sqlite.html.

I'm building with the Android NDK and it succeeds, seemingly fine, but when I load the library as an extension:

sqlite3_exec(db, "SELECT load_extension('libgdal.so', 'sqlite3_extension_init');", callback, 0, &zErrMsg);

I get an error:

"SQL error: undefined symbol: sqlite3_extension_init"

I went looking for the definition of sqlite3_extension_init, and it appears to be define guarded behind "VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED", so I tried to rebuild with that flag set. This is my build script:

#!/usr/bin/env bash

set -e

export PATH=$PATH:`pwd`/android-21-toolchain/bin
export COMMON_FLAGS="-mthumb -DVIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED"
export CFLAGS="$COMMON_FLAGS"
export CXXFLAGS="$COMMON_FLAGS"
export LIBS="-lsupc++ -lstdc++"

./configure --host=arm-linux-androideabi --prefix=`pwd`/external/gdal

make
make install

Scanning the symbols in the produced .so, still doesn't include anything sqlite3* however:

$ nm -A install/external/gdal/lib/libgdal.so | wc -l
   56967
$ nm -A install/external/gdal/lib/libgdal.so | ag sqlite3 | wc -l
       0

I've really been scratching my head over this, so what am I doing glaringly wrong?


Best regards,

René Hansen

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Building with support for VirtualOGR

Even Rouault-2

René,

 

> As the subject reveals, I'm trying to compile with SQLite support, so I can

> load libgdal.so as an extension, as per the example on

> http://gdal.org/drv_sqlite.html.

>

> I'm building with the Android NDK and it succeeds, seemingly fine, but when

> I load the library as an extension:

[...]

> I've really been scratching my head over this, so what am I doing glaringly

> wrong?

 

You don't have to manually define VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED. The likely explanation is that configure fails to detect sqlite3. Did you check the output of the configure to see if there's a "SQLite support: yes" line arround the end ?

 

You may need to add

--with-sqlite3=/path/to/cross/compiled/sqlite3/installation/prefix

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Building with support for VirtualOGR

René Hansen
Jackpot. That was it!

It's amazing what kind of blindspots you can develop, setting up cross compilations.

Now I'm wrestling with build errors related to jpeg and jpeg12, apparently just disabling them with --with-jpeg=no and --without-jpeg12, breaks all kinds of other stuff.

Alas, that is a different battle. Thanks Even!


/René


On Tue, 28 Nov 2017 at 13:28 Even Rouault <[hidden email]> wrote:

René,

 

> As the subject reveals, I'm trying to compile with SQLite support, so I can

> load libgdal.so as an extension, as per the example on

> http://gdal.org/drv_sqlite.html.

>

> I'm building with the Android NDK and it succeeds, seemingly fine, but when

> I load the library as an extension:

[...]

> I've really been scratching my head over this, so what am I doing glaringly

> wrong?

 

You don't have to manually define VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED. The likely explanation is that configure fails to detect sqlite3. Did you check the output of the configure to see if there's a "SQLite support: yes" line arround the end ?

 

You may need to add

--with-sqlite3=/path/to/cross/compiled/sqlite3/installation/prefix

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Building with support for VirtualOGR

René Hansen
For future reference, this was the winning combination to get through a make/install, with the Android NDK for me:

./configure --host=arm-linux-androideabi --prefix=`pwd`/install/external/gdal \
  --with-sqlite3=/path/to/sqlite/xcompilation \
  --with-jpeg=internal \
  --without-jpeg12

Now I've got sqlite3 symbols defined aplenty:

$ nm -A install/external/gdal/lib/libgdal.so | ag sqlite3 | wc -l
     194

Thanks again!

/René

On Tue, 28 Nov 2017 at 14:25 René Hansen <[hidden email]> wrote:
Jackpot. That was it!

It's amazing what kind of blindspots you can develop, setting up cross compilations.

Now I'm wrestling with build errors related to jpeg and jpeg12, apparently just disabling them with --with-jpeg=no and --without-jpeg12, breaks all kinds of other stuff.

Alas, that is a different battle. Thanks Even!


/René


On Tue, 28 Nov 2017 at 13:28 Even Rouault <[hidden email]> wrote:

René,

 

> As the subject reveals, I'm trying to compile with SQLite support, so I can

> load libgdal.so as an extension, as per the example on

> http://gdal.org/drv_sqlite.html.

>

> I'm building with the Android NDK and it succeeds, seemingly fine, but when

> I load the library as an extension:

[...]

> I've really been scratching my head over this, so what am I doing glaringly

> wrong?

 

You don't have to manually define VIRTUAL_OGR_DYNAMIC_EXTENSION_ENABLED. The likely explanation is that configure fails to detect sqlite3. Did you check the output of the configure to see if there's a "SQLite support: yes" line arround the end ?

 

You may need to add

--with-sqlite3=/path/to/cross/compiled/sqlite3/installation/prefix

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev