[gdal-dev] Building java bindings with GDAL 2.1.3

Paolo Corti pcorti at gmail.com
Fri Apr 28 07:13:41 PDT 2017

Hi Even

On Fri, Apr 28, 2017 at 4:13 AM, Even Rouault
<even.rouault at spatialys.com> wrote:
> Yes much likely this error is typical of a mismatch between SWIG 1.3 and
> SWIG 2 or 3. It is likely that the gdal.jar in GeoServer was produced with
> SWIG 1.3, so you'll need to generate the native part (libgdalconstjni.so,
> etc...) with SWIG 1.3 as well (you can build it easily from source,
> ./configure --prefix=$HOME/install-swig-1.3; make; make install and then put
> $HOME/install-swig-1.3/bin in top of your PATH, before building again the
> GDAL Java bindings). Or you may try to replace the gdal.jar located
> somewhere in the geoserver installation with the one you've generated with
> SWIG 3.
> But in both cases I'm not completely sure that things will work due to a few
> (subtle) changes in the GDAL Java API between GDAL 1.x used by this old
> GeoServer and GDAL 2. Depends if GeoServer uses those API.

Thanks for the great help. Compiling with Swig 1.3 did not help (same error).
I figured out, reading at this [1], that the the GeoServer GDAL plugin
must use gdal 1.9.2, as must use imageio-ext-gdal-bindings-1.9.2.jar
(I don't see that .jar available for other versions that 1.9.2).
Therefore I believe the Swig error was caused by using gdal java
bindings mixed between 1.9.2 and 2.1.3 versions.

Therefore, I am trying to compile on Ubuntu 16.04 gdal 1.9.2, but I am
now getting in this error [2].
Is there a workaround for this? The only alternative for me would be
to install Ubuntu 14.04LTS in the server, where I know that gdal 1.9.2
can be compiled correctly.


[1] http://docs.geoserver.org/stable/en/user/data/raster/gdal.html
[2] https://gis.stackexchange.com/questions/180573/django-and-osgeo-closed

Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti

More information about the gdal-dev mailing list