libgdx: gdx-backend-lwjgl3 references natives that cannot be found or do not exist, causes build to fail
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>
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"
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
This happens to me a lot; I usually just remove
mavenLocal()from my Gradlerepositoriesand it works as soon as I sync again. Gradle is not the most reliable software…For me to remove
mavenLocal()fixed the issue