37

I'm currently trying to build a Java project using Maven for a libGDX game I'm working on.

I think I'm using Java 8 OpenJDK (1.8.0_211) on a Ubuntu 18.04 LTS distribution.

The related question debugging ld, "Inconsistency detected by ld.so" was not able to help me. The Java Error Code 127 suggests that a resource cannot be found on my CLASSPATH(?)

The error, formatted for readability:

[java] Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: 
    Assertion `version->filename == NULL || 
    ! _dl_name_match_p (version->filename, map)' failed!
[java] Java Result: 127
xjcl
  • 12,848
  • 6
  • 67
  • 89
  • 3
    Looks like this is somehow related to the java 11 version delivered by ubuntu 18.04: https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1764701 – Sebastian Sep 15 '19 at 12:04
  • Sounds highly likely to me you are actually using OpenJDK 11 instead of OpenJDK 8 like you think. – xjcl May 06 '21 at 15:56

3 Answers3

30

Downgrade OpenJDK 11 to 8

I had the same problem in Xubuntu 18.04 with Eclipse 2018-12 (4.10.0), using LibGDX. It was working fine, but probably some update in the system (or to OpenJDK specifically) started this problem. In addition Gradle Tasks weren't showing up in the Gradle Window.

I solved the issue by removing theses packages: default-jre, default-jdk, default-jre-headless, default-jdk-headless, all of which were "pointing at" openjdk-11.

Then I installed openjdk-8-jre, openjdk-8-jdk, openjdk-8-jre-headless and openjdk-8-jdk-headless.

And I changed eclipse.ini's vm section to: -vm /usr/lib/jvm/java-8-openjdk-amd64/bin

And now everything is working fine, and Gradle tasks are showing again.

xjcl
  • 12,848
  • 6
  • 67
  • 89
snesgx
  • 449
  • 3
  • 4
15

Switch libGDX from lwjgl to lwjgl3

I had the same issue as you with OpenJDK 11 / Java 11 (openjdk 11.0.10 2021-01-19). What fixed it was switching to lwjgl3 everywhere, which incidentally also fixed some other issues for me! (whole screen going black when I exit the app, mouse cursor capture only partially working, etc)

In build.gradle change the first into the second block:

api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"

Also adjust your imports (e.g. in the DesktopLauncher class):

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;

lwjgl3 should be almost entirely compatible, in my case I just needed to update the config:

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.samples = 8;
config.height = 720;
config.width = 1280;
config.vSyncEnabled = true;
new LwjglApplication(new RangeAnxietyGame(), config);
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setBackBufferConfig(8, 8, 8, 8, 16, 0, 8);
config.setWindowedMode(1280, 720);
config.useVsync(true);
new Lwjgl3Application(new RangeAnxietyGame(), config);
xjcl
  • 12,848
  • 6
  • 67
  • 89
  • This solved my problem, thanks. I guess it's the libGDX setup launcher itself, which uses lwjgl instead of lwjgl3. Any idea why it did that? – Hange Zoë Jun 16 '21 at 06:14
  • No idea why the project creator chooses the "wrong" library. I only got the hint to try `lwjgl3` after DMing a libGDX expert on this site! – xjcl Jun 16 '21 at 07:39
  • By this site you mean stackoverflow, right? Because if there is a other site where I can find LibGDX experts I would love to know about it. Even if you can suggest any nice site or forum related to LibGDX it would be appreciated. – Hange Zoë Jun 17 '21 at 16:35
  • Yeah I mean SO! – xjcl Jun 17 '21 at 16:43
  • Unfortunately it also happens with the com.badlogic.gdx.tools.particleeditor.ParticleEditor which has lwjgl hardcoded. I guess I need to fork it. – Sebastian Feb 07 '23 at 20:25
  • 1
    @Sebastian That sounds annoying. I would try reporting it as a bug to libGDX and see if they can fix it or come up with a workaround. – xjcl Feb 08 '23 at 00:42
9

Replace openjdk-11 with adopt-openjdk-11

This problem also showed up for me while using libgdx on Ubuntu 20.04 with openjdk-11.

After a longer struggle I tried another JDK vendor instead of openjdk. This solved my issue. For some reason adopt-opendjk-11 works, while openjdk-11 was not working.

xjcl
  • 12,848
  • 6
  • 67
  • 89
cherrywoods
  • 1,284
  • 1
  • 7
  • 18
  • 1
    Can confirm. I encountered this error on Ubuntu 18.04.4 LTS with the default OpenJDK package, using a library called `Jzy3d`. After completely uninstalling the default OpenJDK and switching to the AdoptOpenJDK package distributed here, the error was resolved: https://adoptopenjdk.net/ – breandan Oct 26 '20 at 02:31
  • This is a proper solution. I just switched from OpenJDK-11 to AdoptOpenJDK-11 as well and it fixed everything. If you're on linux you can install the adopt-openjdk-11 as an alternative like so: `sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.0.13+8/bin/java 100` and then switch between whichever jdk you might need. – Xceno Nov 10 '21 at 09:56