LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: advanced_set on October 12, 2016, 21:08:38

Title: "Mismatch detected between the Java and native libraries"
Post by: advanced_set on October 12, 2016, 21:08:38
Any hint about what could cause this sort of thing?

Code: [Select]
[LWJGL] Version: 3.0.1 build 33
[LWJGL] OS: Mac OS X v10.11.6
[LWJGL] JRE: 1.8.0_60 x86_64
[LWJGL] JVM: Java HotSpot(TM) 64-Bit Server VM v25.60-b23 by Oracle Corporation
[LWJGL] Loading library (system): lwjgl
[LWJGL] Found at: /var/folders/dd/nmh1q42j2rq2klpdwxxwmrp40000gn/T/lwjglLucas/3.0.1-build-33/liblwjgl.dylib
[LWJGL] Loaded from org.lwjgl.librarypath: /var/folders/dd/nmh1q42j2rq2klpdwxxwmrp40000gn/T/lwjglLucas/3.0.1-build-33/liblwjgl.dylib
[LWJGL] [WARNING] Mismatch detected between the Java and native libraries.
[LWJGL] ThreadLocalUtil state: UnsafeState
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
Title: Re: "Mismatch detected between the Java and native libraries"
Post by: spasi on October 12, 2016, 22:00:50
This warning occurs when the SHA1 checksum of liblwjgl.dylib stored inside lwjgl.jar does not match the SHA1 checksum of the liblwjgl.dylib actually loaded at runtime. This is could happen if lwjgl.jar was updated but the native jar was not.

Did you manually download the build or did you use Maven/Gradle?
Title: Re: "Mismatch detected between the Java and native libraries"
Post by: advanced_set on October 12, 2016, 23:39:09
Thanks. That seems to be the problem.

It was an old project with the "lwjgl-platform" solution. So apparently I was downloading the last java bindings and an old "lwjgl-platform" that it was still available in the repository.

I see that each library has its native counterpart now. I will update the project build.
Title: Re: "Mismatch detected between the Java and native libraries"
Post by: advanced_set on October 16, 2016, 15:04:52
After a bit of fighting, it seems that I managed to put lwjgl to work with SBT (scala building tool)

just to let you guys know if someone find this useful, here is the build.sbt:

Code: [Select]

name := "lwjgl3-sandbox"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.11.8"

resolvers += Resolver.sonatypeRepo("snapshots") // <-- sbt has a predefined resolver for sonatype

val version_ = "3.0.1-SNAPSHOT"
val natives_mac = "natives-macos" // <-- you can add the other classifiers if you want

// you may (temporarily) disable the constant update by uncommenting the line below
// updateOptions := updateOptions.value.withLatestSnapshots(false)
// see: http://www.scala-sbt.org/0.13/docs/sbt-0.13-Tech-Previews.html

libraryDependencies += "org.lwjgl" % "lwjgl" % version_
libraryDependencies += "org.lwjgl" % "lwjgl" % version_ % "runtime" classifier natives_mac
libraryDependencies += "org.lwjgl" % "lwjgl-glfw" % version_
libraryDependencies += "org.lwjgl" % "lwjgl-glfw" % version_ % "runtime" classifier natives_mac
libraryDependencies += "org.lwjgl" % "lwjgl-opengl" % version_

// lwjgl-opengl does not have a native counterpart? took me a while to find this.
//libraryDependencies += "org.lwjgl" % "lwjgl-opengl" % version_ % "runtime" classifier natives_mac


I added this lines of code to a test be sure that everything was working fine:

Code: [Select]
        System.out.println("Working Directory = " + System.getProperty("user.dir"));
        System.out.println("Natives Directory = " + System.getProperty("java.library.path"));
        ClassLoader cl = ClassLoader.getSystemClassLoader();
        URL[] urls = ((URLClassLoader)cl).getURLs();
        for(URL url: urls){
            System.out.println(url.getFile());
        }

converting the POM using scripts or using the a POM reader plugin for sbt did not work for me.