libgdx/gdx-liftoff

Clarify LWJGL2 Compatibility with JDK17+ in Documentation

SonicGDX opened this issue · 5 comments

OS: Linux
gdx-liftoff version: 1.12.1.6

Steps I used to reproduce:

  1. Create a project with template Game.
  2. Tick legacy desktop as a platform (I kept lwjgl3 too)
  3. Try running the project with lwjgl2->application->run in intelliJ.

It says the run was successful but in reality the application didn't show up and I had this log:

Executing 'run'...

> Task :core:compileJava UP-TO-DATE
> Task :core:processResources NO-SOURCE
> Task :core:classes UP-TO-DATE
> Task :core:jar UP-TO-DATE
> Task :lwjgl2:compileJava UP-TO-DATE
> Task :lwjgl2:processResources UP-TO-DATE
> Task :lwjgl2:classes UP-TO-DATE

> Task :lwjgl2:run

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.6/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 884ms
5 actionable tasks: 1 executed, 4 up-to-date
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.lwjgl.LWJGLUtil$3 (file:[redacted]/.gradle/caches/modules-2/files-2.1/org.lwjgl.lwjgl/lwjgl/2.9.3/3df168ac74e4a8c96562cdff24ad352e255bf89c/lwjgl-2.9.3.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.lwjgl.LWJGLUtil$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Inconsistency detected by ld.so: dl-lookup.c: 106: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!
Execution finished 'run'.

openjdk-17 doesn't work for running LWJGL2. You can stick with openjdk-8, or you may have better luck with other Java distributions. LWJGL2 is not maintained (last release 9 years ago) so this will not be fixed.

Yeah I just tested an old built jar file and it failed with the same error. JDK incompatibility makes sense. It's definitely not a liftoff issue, although I think it is worth mentioning in the documentation somewhere that LWJGL2 is broken with Java 17+, since that is the version recommended for the rest.

Might be easiest to ask the user if they know what they're doing, if selecting that option, as issues with the LWJGL2 backend extend far beyond this. In a way, this specific issue is a niche one - the number of people who will want to use the obsolete and abandoned backend is minimal, and the subset of those users who are on Linux with the JRE from their distro-provided repositories is even smaller.

Yeah, this isn't really a Liftoff issue, it's an issue with specific vendors of OpenJDK (on Linux or maybe MacOS only) not interoperating with the dilapidated LWJGL2 code. I'm also pretty sure that LWJGL2 is broken on distro-provided JDKs for versions earlier than 17, though I don't know how early. I think Adoptium should work. I don't have a Linux machine to test on right now.

Just tested with Temurin 17 and it does work. Apologies, I assumed it was an issue with Java 17 in general. An interesting bug for sure, I'll probably stop using the distro ones now.

BTW: I would recommend WSL if you want an easy way to test Linux stuff on Windows