jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.78k stars 1.12k forks source link

Lwjgl-2 doesn't support Oracle-JDK-19 #1985

Closed pavly-gerges closed 1 year ago

pavly-gerges commented 1 year ago

Today, i was randomly testing the behavior of a jMonkeyEngine desktop application using oracle-jdk-19 on a linux amd64 machine, and some native binaries have been removed from the jdk-19 libjawt.so or may be get merged into another shared object file, i have to look for this binary specifically on the JEPs, but later. i opened the issue for now to not mess this out...

here is the crashlogs:

└──╼ $./gradlew -Dorg.gradle.java.home="/home/twisted/GradleProjects/Serial4j-v1/jdk-19" run
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Task :desktop:run
Mar 12, 2023 8:26:20 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.4.0-stable
 * Branch: HEAD
 * Git Hash: cb5173b
 * Build Date: 2021-05-30
Exception in thread "jME3 Main" java.lang.UnsatisfiedLinkError: /home/pavl-machine/Music/CrossPlatformModule/desktop/liblwjgl64.so: /home/twisted/GradleProjects/Serial4j-v1/jdk-19/lib/libjawt.so: version `SUNWprivate_1.1' not found (required by /home/pavl-machine/Music/CrossPlatformModule/desktop/liblwjgl64.so)
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404)
        at java.base/java.lang.Runtime.load0(Runtime.java:785)
        at java.base/java.lang.System.load(System.java:2009)
        at org.lwjgl.Sys$1.run(Sys.java:70)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
        at org.lwjgl.Sys.loadLibrary(Sys.java:87)
        at org.lwjgl.Sys.<clinit>(Sys.java:117)
        at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:220)
        at java.base/java.lang.Thread.run(Thread.java:1589)

BUILD SUCCESSFUL in 26s
7 actionable tasks: 4 executed, 3 up-to-date

EDIT: Lwjgl-3 works fine when running the application using jdk-19.

pavly-gerges commented 1 year ago

If we know what had happened to libawt.so source code, we could redirect the call to the new binary, i cannot find anything related to awt on the jdk-19 JEPs, have anyone tried jdk-18 with lwjgl-2 ? Can you reproduce this issue with jdk-18 ?

Ali-RS commented 1 year ago

Running on jMonkeyEngine 3.4.0-stable

Hehe! update to 3.6.0-beta3 and it should be fine I believe ;)

Ali-RS commented 1 year ago

Duplicate of https://github.com/jMonkeyEngine/jmonkeyengine/issues/1215

Ali-RS commented 1 year ago

@Scrappers-glitch please feel free to reopen this issue if it still happens with 3.6.0-beta3.

pavly-gerges commented 1 year ago

I tested it now and it happens with v3.6.0-beta3 (as long as the native core of lwjgl-2 hasn't changed then i suspected this).

Ali-RS commented 1 year ago

Oops! going to test it now.

pavly-gerges commented 1 year ago

I am going to test it with open-jdk but later not now, but hey everything should support oracle jdk....

pavly-gerges commented 1 year ago

I navigated to the root jdk-19 directory and found the libawt.so binary....

┌─[pavl-machine@pavl-machine]─[/home/twisted/GradleProjects/Serial4j-v1/jdk-19]
└──╼ $ls */* | grep libawt
lib/libawt_headless.so
lib/libawt.so
lib/libawt_xawt.so

The issue is related specifically to the SUNWprivate_1.1 version of libawt that it is not found or has changed, any ideas on what is this ???

Ali-RS commented 1 year ago

@Scrappers-glitch did you remove old lwjgl2 natives before updating to jme 3.6.0-beta3?

Make sure to remove old lwjgl2 natives so the new ones get extracted.

pavly-gerges commented 1 year ago

@Scrappers-glitch did you remove old lwjgl2 natives before updating to jme 3.6.0-beta3?

Make sure to remove old lwjgl2 natives so the new ones get extracted.

It ran fine now, thank you !

I see there was a change in the lwjgl-2 binaries on commit https://github.com/jMonkeyEngine/jmonkeyengine/commit/3e1b823bdb7c7a2e60916dab32186141b3fd9800

Ali-RS commented 1 year ago

Yes, natives for Linux are updated. They are built with java 11.

Edit: See https://github.com/jMonkeyEngine/lwjgl2/commit/eb0c8dc710bd1d3b7e4ad8b2f0dce4ee71a06509

MeFisto94 commented 1 year ago

FWIW this is all exactly the reason "the old" jwlgl2 didn't run, "sun private" fields have been removed from existing .so's, causing a rebuild. Could have been that we'd need to re-build with 19, but luckily it's the same regression that we had on 11 already, albeit the symptom is now more explicit