question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gdx-backend-lwjgl3 references natives that cannot be found or do not exist, causes build to fail

See original GitHub issue

Issue details

In a new project created with the provided tool and imported with IntelliJ IDEA, with a project SDK of 18 and running on Linux, trying to run or build the project fails as gradle cannot locate “natives-linux-arm64” for lwjgl-glfw, lwjgl-openal, lwjgl-opengl, lwjgl-stb and lwjgl.

Version of libGDX and/or relevant dependencies

        gdxVersion = '1.11.0'
        roboVMVersion = '2.3.16'
        box2DLightsVersion = '1.5'
        ashleyVersion = '1.7.4'
        aiVersion = '1.8.2'
        gdxControllersVersion = '2.2.1'

Stacktrace

Without fix:

com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not find lwjgl-glfw-3.3.1-natives-linux-arm64.jar (org.lwjgl:lwjgl-glfw:3.3.1).
Searched in the following locations:
    file:/home/wasabi/.m2/repository/org/lwjgl/lwjgl-glfw/3.3.1/lwjgl-glfw-3.3.1-natives-linux-arm64.jar
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:388)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:137)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:42)
	<truncated>

See full paste here

With “fix”: Runs fine, however:

[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • macOS

The “fix”: This is not at all ideal, and essentially just excludes lwjgl, lwjgl-glfw etc. from gdx-backend-lwjgl3 and replaces it with all the same stuff except excluding the natives that cause trouble. I’ve commented out the windows and mac natives, because for some reason they cannot be found on my Linux machine similarly to the Linux ARM64 natives that originally caused this problem (which are also commented out). This is a problem because it will produce a binary that’s not actually cross-platform, however it at least runs and I can continue development. The list of natives is based on the pom.xml file for gdx-backend-lwjgl3.

project(":desktop") {
    apply plugin: "java-library"


    dependencies {
        implementation project(":core")
        api("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion") {
            // this is required because gdx-backend-lwjgl3 tries to link in non-existent ARM64 natives
            exclude group: 'org.lwjgl', module: 'lwjgl-glfw'
            exclude group: 'org.lwjgl', module: 'lwjgl-openal'
            exclude group: 'org.lwjgl', module: 'lwjgl-opengl'
            exclude group: 'org.lwjgl', module: 'lwjgl-stb'
            exclude group: 'org.lwjgl', module: 'lwjgl'
        }
        api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"

        // re-add the dependencies manually, no natives
        api "org.lwjgl:lwjgl-glfw:3.3.1"
        api "org.lwjgl:lwjgl-openal:3.3.1"
        api "org.lwjgl:lwjgl-opengl:3.3.1"
        api "org.lwjgl:lwjgl-stb:3.3.1"
        api "org.lwjgl:lwjgl:3.3.1"

        // selectively re-add the natives
        // Linux //
        api "org.lwjgl:lwjgl-glfw:3.3.1:natives-linux"
        api "org.lwjgl:lwjgl-glfw:3.3.1:natives-linux-arm32"
        // api "org.lwjgl:lwjgl-glfw:3.3.1:natives-linux-arm64"
        api "org.lwjgl:lwjgl-openal:3.3.1:natives-linux"
        api "org.lwjgl:lwjgl-openal:3.3.1:natives-linux-arm32"
        // api "org.lwjgl:lwjgl-openal:3.3.1:natives-linux-arm64"
        api "org.lwjgl:lwjgl-opengl:3.3.1:natives-linux"
        api "org.lwjgl:lwjgl-opengl:3.3.1:natives-linux-arm32"
        // api "org.lwjgl:lwjgl-opengl:3.3.1:natives-linux-arm64"
        api "org.lwjgl:lwjgl-stb:3.3.1:natives-linux"
        api "org.lwjgl:lwjgl-stb:3.3.1:natives-linux-arm32"
        // api "org.lwjgl:lwjgl-stb:3.3.1:natives-linux-arm64"
        api "org.lwjgl:lwjgl:3.3.1:natives-linux"
        api "org.lwjgl:lwjgl:3.3.1:natives-linux-arm32"
        // api "org.lwjgl:lwjgl:3.3.1:natives-linux-arm64"

        // MacOS //
        /*
        api "org.lwjgl:lwjgl-glfw:3.3.1:natives-macos"
        api "org.lwjgl:lwjgl-glfw:3.3.1:natives-macos-arm64"
        api "org.lwjgl:lwjgl-openal:3.3.1:natives-macos"
        api "org.lwjgl:lwjgl-openal:3.3.1:natives-macos-arm64"
        api "org.lwjgl:lwjgl-opengl:3.3.1:natives-macos"
        api "org.lwjgl:lwjgl-opengl:3.3.1:natives-macos-arm64"
        api "org.lwjgl:lwjgl-stb:3.3.1:natives-macos"
        api "org.lwjgl:lwjgl-stb:3.3.1:natives-macos-arm64"
        api "org.lwjgl:lwjgl:3.3.1:natives-macos"
        api "org.lwjgl:lwjgl:3.3.1:natives-macos-arm64"
         */

        // Windows //
        /*
        api "org.lwjgl:lwjgl-glfw:3.3.1:natives-windows"
        api "org.lwjgl:lwjgl-glfw:3.3.1:natives-windows-x86"
        api "org.lwjgl:lwjgl-openal:3.3.1:natives-windows"
        api "org.lwjgl:lwjgl-openal:3.3.1:natives-windows-x86"
        api "org.lwjgl:lwjgl-opengl:3.3.1:natives-windows"
        api "org.lwjgl:lwjgl-opengl:3.3.1:natives-windows-x86"
        api "org.lwjgl:lwjgl-stb:3.3.1:natives-windows"
        api "org.lwjgl:lwjgl-stb:3.3.1:natives-windows-x86"
        api "org.lwjgl:lwjgl:3.3.1:natives-windows"
        api "org.lwjgl:lwjgl:3.3.1:natives-windows-x86"
         */
    }
}

Compare to this version given by the project creation tool, which “causes” the error described:

    dependencies {
        implementation project(":core")
        api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
        api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        api "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
    }

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
tommyettingercommented, May 22, 2022

This happens to me a lot; I usually just remove mavenLocal() from my Gradle repositories and it works as soon as I sync again. Gradle is not the most reliable software…

0reactions
Tom-Skicommented, May 25, 2022

Oh, @WasabiThumb have you used pure maven with this same version? Like a project managed by maven bringing in deps of 3.3.1?

If you did, and had

<dependency>
  <groupId>org.lwjgl</groupId>
  <artifactId>lwjgl</artifactId>
  <version>3.3.1</version>
  <classifier>natives-linux</classifier>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.lwjgl</groupId>
  <artifactId>lwjgl</artifactId>
  <version>3.3.1</version>
  <classifier>natives-linux-arm32</classifier>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.lwjgl</groupId>
  <artifactId>lwjgl</artifactId>
  <version>3.3.1</version>
  <classifier>natives-linux-arm64</classifier>
  <scope>compile</scope>
</dependency>

only, then it all makes sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found