GeoTools
  1. GeoTools
  2. GEOT-4104

Build failure with UnsatisfiedLinkError in imagio-ext-gdal

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 8.0-RC1
    • Fix Version/s: 8.0-RC2
    • Labels:
      None
    • Environment:

      Description

      Build of imagio-ext-gdal passes in Maven 2 / 32-bit but fails in Maven 3 / 64-bit with UnsatisfiedLinkError:

      Results :
      
      Tests in error: 
        test(org.geotools.coverageio.gdal.envihdr.EnviHdrTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.envihdr.EnviHdrTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.rpftoc.RPFTOCTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.rpftoc.RPFTOCTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.aig.AIGTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.aig.AIGTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.idrisi.IDRISIImgTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.idrisi.IDRISIImgTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.nitf.NITFTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.nitf.NITFTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.dted.DTEDTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testService(org.geotools.coverageio.gdal.dted.DTEDTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.erdasimg.ErdasImgTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.erdasimg.ErdasImgTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        test(org.geotools.coverageio.gdal.ehdr.EsriHdrTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
        testIsAvailable(org.geotools.coverageio.gdal.ehdr.EsriHdrTest): org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
      
      Tests run: 26, Failures: 0, Errors: 16, Skipped: 0
      

      In Eclipse (Indigo R2, Java 6 64-bit) the stack traces look like:

      java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.SWIGDriverUpcast(J)J
      	at org.gdal.gdal.gdalJNI.SWIGDriverUpcast(Native Method)
      	at org.gdal.gdal.Driver.<init>(Driver.java:18)
      	at org.gdal.gdal.gdal.GetDriverByName(gdal.java:521)
      	at it.geosolutions.imageio.gdalframework.GDALUtilities.isDriverAvailable(GDALUtilities.java:355)
      	at it.geosolutions.imageio.gdalframework.GDALImageReaderSpi.isAvailable(GDALImageReaderSpi.java:257)
      	at org.geotools.coverageio.gdal.aig.AIGFormatFactory.isAvailable(AIGFormatFactory.java:61)
      	at org.geotools.coverageio.gdal.GDALTestCase.testingEnabled(GDALTestCase.java:105)
      	at org.geotools.coverageio.gdal.GDALTestCase.setUp(GDALTestCase.java:88)
      

        Activity

        Hide
        Ben Caradoc-Davies added a comment -
        I recently installed the Fedora gdal-java and gdal-devel packages for an unrelated purpose. These might have tricked GDALUtilities.isDriverAvailable into thinking that I have enough support to load these.
        {noformat}
        $ rpm -qa | grep gdal
        gdal-1.7.3-14.fc15.x86_64
        gdal-java-1.7.3-14.fc15.x86_64
        gdal-devel-1.7.3-14.fc15.x86_64
        {noformat}
        I don't want to use GDAL from GeoTools. I just want GeoTools to build under Maven 3.
        Show
        Ben Caradoc-Davies added a comment - I recently installed the Fedora gdal-java and gdal-devel packages for an unrelated purpose. These might have tricked GDALUtilities.isDriverAvailable into thinking that I have enough support to load these. {noformat} $ rpm -qa | grep gdal gdal-1.7.3-14.fc15.x86_64 gdal-java-1.7.3-14.fc15.x86_64 gdal-devel-1.7.3-14.fc15.x86_64 {noformat} I don't want to use GDAL from GeoTools. I just want GeoTools to build under Maven 3.
        Show
        Ben Caradoc-Davies added a comment - Looks similar to this: http://java.net/projects/imageio-ext/lists/dev/archive/2010-08/message/0
        Hide
        Ben Caradoc-Davies added a comment -
        The reason my build passes with Maven 2 / 32-bit is I don't have 32-bit gdal libraries installed.
        Show
        Ben Caradoc-Davies added a comment - The reason my build passes with Maven 2 / 32-bit is I don't have 32-bit gdal libraries installed.
        Hide
        Ben Caradoc-Davies added a comment -
        Looks like a bug in GDALUtilities.isDriverAvailable; should it catch UnsatisfiedLinkError thrown by gdal.GetDriverByName, log the message, and return false? If this method throws, then I would suggest that the driver is not available.
        Show
        Ben Caradoc-Davies added a comment - Looks like a bug in GDALUtilities.isDriverAvailable; should it catch UnsatisfiedLinkError thrown by gdal.GetDriverByName, log the message, and return false? If this method throws, then I would suggest that the driver is not available.
        Hide
        Daniele Romagnoli added a comment -
        That message is thrown when there aren't proper Java JNI bindings available on the system.
        I agree with you that we should try-catch the driver search too in order to better deal with these cases where there are different GDAL sets/packages on the path.
        The link you have reported is related to a similar problem where the user has generated java bindings by himself with a 2.x version of SWIG which didn't properly create all the required methods. The problem has been fixed when the user adopted SWIG-1.3.36 to generate the bindints. Maybe, the gdal-java package you got from Fedora has the same problem.
        Anyway... could you please open a ticket on imageio-ext to report the problem?

        Show
        Daniele Romagnoli added a comment - That message is thrown when there aren't proper Java JNI bindings available on the system. I agree with you that we should try-catch the driver search too in order to better deal with these cases where there are different GDAL sets/packages on the path. The link you have reported is related to a similar problem where the user has generated java bindings by himself with a 2.x version of SWIG which didn't properly create all the required methods. The problem has been fixed when the user adopted SWIG-1.3.36 to generate the bindints. Maybe, the gdal-java package you got from Fedora has the same problem. Anyway... could you please open a ticket on imageio-ext to report the problem?
        Hide
        Ben Caradoc-Davies added a comment -
        Daniele,

        I have created an imageio-ext issue for this problem:
        http://java.net/jira/browse/IMAGEIO_EXT-40

        Kind regards,
        Ben.
        Show
        Ben Caradoc-Davies added a comment - Daniele, I have created an imageio-ext issue for this problem: http://java.net/jira/browse/IMAGEIO_EXT-40 Kind regards, Ben.
        Hide
        Daniele Romagnoli added a comment -
        Thanks Ben,
        I'll work on it as soon as possible.

        Cheers,
        Daniele
        Show
        Daniele Romagnoli added a comment - Thanks Ben, I'll work on it as soon as possible. Cheers, Daniele
        Hide
        Daniele Romagnoli added a comment -
        ImageIO-Ext Reference JIRA link:
        http://java.net/jira/browse/IMAGEIO_EXT-40

        Show
        Daniele Romagnoli added a comment - ImageIO-Ext Reference JIRA link: http://java.net/jira/browse/IMAGEIO_EXT-40
        Hide
        Ben Caradoc-Davies added a comment -
        Not a blocker.
        Show
        Ben Caradoc-Davies added a comment - Not a blocker.
        Hide
        Ben Caradoc-Davies added a comment -
        -------- Original Message --------
        Subject: [udig-devel] ImageI/O-Ext 1.1.4 released
        Date: Tue, 19 Jun 2012 16:18:04 +0800
        From: Daniele Romagnoli
        Reply-To: User-friendly Desktop Internet GIS
        <udig-devel@lists.refractions.net>
        To: Geotools-Devel list <geotools-devel@lists.sourceforge.net>,
        Geoserver-devel <geoserver-devel@lists.sourceforge.net>, User-friendly
        Desktop Internet GIS <udig-devel@lists.refractions.net>



        Folks,
        GeoSolutions is pleased to announce the ImageI/O-Ext 1.1.4release.
        Changes with respect to 1.1.3 can be summarised as follows:

          * Better GDAL Driver availability checks.
          * Better TIFF-Metadata management (Tile ByteCounts and Offsets aren't
            stored into IIOMetadata node textual attributes anymore).
          * Minor Improvements on Kakadu based JP2K writer

        In the next hours, we will update geotools to depend on this new
        version. (sorry for cross posting)
        For project maintainers: there is NO need to change any GDAL native
        library (.so/.dll) after this update.

        Regards,
        the GeoSolutions <http://www.geo-solutions.it/> Team





        --
        -------------------------------------------------------
        Ing. Daniele Romagnoli
        GeoSolutions S.A.S.
        Software Engineer
        Show
        Ben Caradoc-Davies added a comment - -------- Original Message -------- Subject: [udig-devel] ImageI/O-Ext 1.1.4 released Date: Tue, 19 Jun 2012 16:18:04 +0800 From: Daniele Romagnoli Reply-To: User-friendly Desktop Internet GIS < udig-devel@lists.refractions.net > To: Geotools-Devel list < geotools-devel@lists.sourceforge.net >, Geoserver-devel < geoserver-devel@lists.sourceforge.net >, User-friendly Desktop Internet GIS < udig-devel@lists.refractions.net > Folks, GeoSolutions is pleased to announce the ImageI/O-Ext 1.1.4release. Changes with respect to 1.1.3 can be summarised as follows:   * Better GDAL Driver availability checks.   * Better TIFF-Metadata management (Tile ByteCounts and Offsets aren't     stored into IIOMetadata node textual attributes anymore).   * Minor Improvements on Kakadu based JP2K writer In the next hours, we will update geotools to depend on this new version. (sorry for cross posting) For project maintainers: there is NO need to change any GDAL native library (.so/.dll) after this update. Regards, the GeoSolutions < http://www.geo-solutions.it/ > Team -- ------------------------------------------------------- Ing. Daniele Romagnoli GeoSolutions S.A.S. Software Engineer
        Hide
        Ben Caradoc-Davies added a comment -
        Confirmed fixed.
        Show
        Ben Caradoc-Davies added a comment - Confirmed fixed.

          People

          • Assignee:
            Simone Giannecchini
            Reporter:
            Ben Caradoc-Davies
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: