Hi,

I was looking at LibJPEGTurbo on OS X and noticed a possible problem.

Over in TurboJpegUtilities#load()

 public static final String LIBNAME = "turbojpeg";

 static void load() {
        try {
            System.loadLibrary(LIBNAME); // If this method is called
more than once with the same library name, the second and subsequent
calls are ignored.
            if (LOGGER.isLoggable(Level.INFO)) {
                LOGGER.info("TurboJPEG library loaded ("+LIBNAME+")");
            }
        } catch (java.lang.UnsatisfiedLinkError e) {
            String os = System.getProperty("os.name").toLowerCase();
            if (os.indexOf("mac") >= 0) {
                System.load("/usr/lib/libturbojpeg.jnilib");
            } else {
                throw e;
            }
        }
    }

On OS X, the first System.loadLibrary(LIBNAME) fails, but it succeeds
with the System.load("/usr/lib/libturbojpeg.jnilib");

However, for the TurboImageWorkerTest#writer test, it eventually gets down to
   TurboJpegImageWriter  line 196;

 compressor = new TJCompressor();

However, TJCompressor (line 456) - part of the
turbojpeg-wrapper-1.2.1.1 jar - has a static initializer;

static {
    TJLoader.load();
  }

final class TJLoader {
  static void load() {
    System.loadLibrary("turbojpeg");
  }
};

This throws the UnsatisfiedLinkError exception (as above).

Is anyone getting the tests to run on OS X with libjepgturbo installed?




The API documentation for System.loadLibrary(name) says;
"
 The call <code>System.loadLibrary(name)</code> is effectively
equivalent to the call
Runtime.getRuntime().loadLibrary(name) " which (as noted in the
comments, above) says "If this method is called more than once with
the same library  name, the second and subsequent calls are ignored.".

However, this throws the exception twice;

         try {
             System.loadLibrary("turbojpeg");
        }    catch (java.lang.UnsatisfiedLinkError e)        {
            System.loadLibrary("turbojpeg");
        }

So does this;

        try{
            Runtime.getRuntime().loadLibrary("turbojpeg");
        }
        catch (java.lang.UnsatisfiedLinkError e)
        {
            Runtime.getRuntime().loadLibrary("turbojpeg");
        }

$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)



Is anyone having troubles with LibJPEGTurbo on OS X?  I expect it's
fine on other OSes.

Thanks,
Dave

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to