Closed VVD closed 1 year ago
Hey @VVD,
You can see the required Linux dependencies here: LWJGL-CI/lwjgl3.
It should be possible to use a non-default GCC by passing -Dgcc.version=11
to the ant build.
Hey @VVD,
Hello, @Spasi!
You can see the required Linux dependencies here: LWJGL-CI/lwjgl3.
I'll check, thanks.
It should be possible to use a non-default GCC by passing
-Dgcc.version=11
to the ant build.
But how set path to it (like JAVA_HOME, but for GCC)?
@Spasi
. /opt/rh/devtoolset-11/enable
switch default gcc to 11.
Require devtoolset-11-libatomic-devel
too.
But there are other errors:
preadv2
:
[Compiler] /build/lwjgl3-3.3.1/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c: In function ‘Java_org_lwjgl_system_linux_UIO_npreadv2’:
[Compiler] /build/lwjgl3-3.3.1/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c:52:23: error: implicit declaration of function ‘preadv2’; did you mean ‘preadv’? [-Werror=implicit-function-declaration]
[Compiler] 52 | __result = (jlong)preadv2(__fd, __iovec, __count, (off_t)__offset, __flags);
[Compiler] | ^~~~~~~
[Compiler] | preadv
[Compiler] compilation terminated due to -Wfatal-errors.
[Compiler] cc1: all warnings being treated as errors
preadv2() and pwritev2() first appeared in Linux 4.6. Library support was added in glibc 2.26.
https://manpages.debian.org/testing/manpages-dev/preadv2.2.en.html
Is it possible to build lwjgl 3.3 with glibc 2.17?
One more (didn't explore what is it, but know that io_uring
is very new feature in Linux):
[Compiler] In file included from /build/lwjgl3-3.3.1/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_liburing_LibIOURing.c:7:
[Compiler] ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h:36:17: error: unknown type name ‘__kernel_rwf_t’
[Compiler] 36 | __kernel_rwf_t rw_flags;
[Compiler] | ^~~~~~~~~~~~~~
[Compiler] compilation terminated due to -Wfatal-errors.
Still can't find glibconfig.h
:
[Compiler] In file included from /build/lwjgl3-3.3.1/modules/lwjgl/nfd/src/main/c/nfd_common.c:18:
[Compiler] /build/lwjgl3-3.3.1/modules/lwjgl/nfd/src/main/c/ftg_core.h: In function ‘ftg_bzero’:
[Compiler] /build/lwjgl3-3.3.1/modules/lwjgl/nfd/src/main/c/ftg_core.h:1136:5: warning: implicit declaration of function ‘explicit_bzero’ [-Wimplicit-function-declaration]
[Compiler] 1136 | explicit_bzero(ptr, num);
[Compiler] | ^~~~~~~~~~~~~~
[Compiler] In file included from /usr/include/glib-2.0/glib/galloca.h:32,
[Compiler] from /usr/include/glib-2.0/glib.h:30,
[Compiler] from /usr/include/gtk-3.0/gdk/gdkconfig.h:13,
[Compiler] from /usr/include/gtk-3.0/gdk/gdk.h:30,
[Compiler] from /usr/include/gtk-3.0/gtk/gtk.h:30,
[Compiler] from /root/lwjgl3-3.3.1/modules/lwjgl/nfd/src/main/c/nfd_gtk.c:10:
[Compiler] /usr/include/glib-2.0/glib/gtypes.h:32:10: fatal error: glibconfig.h: Нет такого файла или каталога
[Compiler] 32 | #include <glibconfig.h>
[Compiler] | ^~~~~~~~~~~~~~
[Compiler] compilation terminated.
Workaround "dirty hack":
ln -s /usr/lib64/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/glibconfig.h
So 3rd error "resolved".
But 1st and 2nd are here.
preadv2
usage in code of lwjgl3. Function just exported for external usage.
So this is my workaround:
--- modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c.orig
+++ modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c
@@ -49,7 +49,11 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_s
struct iovec const *__iovec = (struct iovec const *)(uintptr_t)__iovecAddress;
jlong __result;
UNUSED_PARAMS(__env, clazz)
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26)
__result = (jlong)preadv2(__fd, __iovec, __count, (off_t)__offset, __flags);
+#else
+ __result = (jlong)preadv(__fd, __iovec, __count, (off_t)__offset);
+#endif
saveErrno();
return __result;
}
@@ -58,7 +62,11 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_s
struct iovec const *__iovec = (struct iovec const *)(uintptr_t)__iovecAddress;
jlong __result;
UNUSED_PARAMS(__env, clazz)
+#if __GLIBC_MINOR__ >= 26
__result = (jlong)pwritev2(__fd, __iovec, __count, (off_t)__offset, __flags);
+#else
+ __result = (jlong)pwritev(__fd, __iovec, __count, (off_t)__offset);
+#endif
saveErrno();
return __result;
}
--- modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h.orig
+++ modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h
@@ -15,6 +15,10 @@
extern "C" {
#endif
+#ifndef kernel_rwf_t +typedef int bitwise __kernel_rwf_t; +#endif + /*
Found here: https://lore.kernel.org/all/20200717080840.GB32407@dell5510/T/
Then I checked /usr/include/linux/fs.h on Ubuntu 20.04 and CentOS 7.9.
On Ubuntu 20.04 it have line `typedef int __bitwise __kernel_rwf_t;`, but on CentOS 7.9 no this line.
BUILD SUCCESSFUL
now after these patches - time to test software!
:-(
java.lang.ExceptionInInitializerError
at ejj.<init>(SourceFile:814)
at ejf.<init>(SourceFile:467)
at net.minecraft.client.main.Main.a(SourceFile:205)
at net.minecraft.client.main.Main.main(SourceFile:51)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: Failed to dynamically load library: /tmp/lwjglvvd/3.3.1-build-7/libglfw.so(error = null)
at ecy.<clinit>(SourceFile:44)
... 4 more
Caused by: java.lang.UnsatisfiedLinkError: Failed to dynamically load library: /tmp/lwjglvvd/3.3.1-build-7/libglfw.so(error = null)
at org.lwjgl.system.linux.LinuxLibrary.loadLibrary(LinuxLibrary.java:33)
at org.lwjgl.system.linux.LinuxLibrary.<init>(LinuxLibrary.java:20)
at org.lwjgl.system.APIUtil.apiCreateLibrary(APIUtil.java:111)
at org.lwjgl.system.Library.loadNative(Library.java:363)
at org.lwjgl.system.Library.loadNativeFromLibraryPath(Library.java:352)
at org.lwjgl.system.Library.loadNative(Library.java:266)
at org.lwjgl.system.Library.loadNative(Library.java:224)
at org.lwjgl.glfw.GLFW.<clinit>(GLFW.java:30)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160)
at java.base/java.lang.invoke.DirectMethodHandle.checkInitialized(DirectMethodHandle.java:384)
at java.base/java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:372)
at java.base/java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:394)
at ecy.<clinit>(SourceFile:41)
... 4 more
Tried replace all jars. Tried replace lwjgl-3.3.1-natives-linux.jar only - same result. BTW, why they have version number in name? Is it important?
For information error if run with default jars:
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /tmp/lwjglvvd/3.3.1-build-7/liblwjgl.so: /lib64/libc.so.6: version `GLIBC_2.26' not found (required by /tmp/lwjglvvd/3.3.1-build-7/liblwjgl.so)
Build script:
#!/bin/sh
set -x
# wget https://github.com/LWJGL/lwjgl3/archive/refs/tags/3.3.1.tar.gz
rm -rf lwjgl3-3.3.1
tar -zxf 3.3.1.tar.gz
cd lwjgl3-3.3.1
export ANT_OPTS=-Xmx2G
export LWJGL_BUILD_TYPE=release/3.3.1
export LWJGL_BUILD_ARCH=x64
export JAVA_HOME=/usr/lib/jvm/java-11
ant compile-templates
ant generate
ant compile
patch -p1 -i ../lwjgl3.patch
. /opt/rh/devtoolset-11/enable
ant compile-native
export JAVA8_HOME="${JAVA_HOME}"
export LWJGL_BUILD_OFFLINE=true
ant release -Djavadoc.skip=true -Dbuild.revision=7 -Dbuild.version=3.3.1
lwjgl3.patch:
diff -ur a/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c b/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c
--- a/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c
+++ b/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_UIO.c
@@ -49,7 +49,11 @@
struct iovec const *__iovec = (struct iovec const *)(uintptr_t)__iovecAddress;
jlong __result;
UNUSED_PARAMS(__env, clazz)
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26)
__result = (jlong)preadv2(__fd, __iovec, __count, (off_t)__offset, __flags);
+#else
+ __result = (jlong)preadv(__fd, __iovec, __count, (off_t)__offset);
+#endif
saveErrno();
return __result;
}
@@ -58,7 +62,11 @@
struct iovec const *__iovec = (struct iovec const *)(uintptr_t)__iovecAddress;
jlong __result;
UNUSED_PARAMS(__env, clazz)
+#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26)
__result = (jlong)pwritev2(__fd, __iovec, __count, (off_t)__offset, __flags);
+#else
+ __result = (jlong)pwritev(__fd, __iovec, __count, (off_t)__offset);
+#endif
saveErrno();
return __result;
}
diff -ur a/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h b/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h
--- a/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h
+++ b/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h
@@ -15,6 +15,10 @@
extern "C" {
#endif
+#ifndef __kernel_rwf_t
+typedef int __bitwise __kernel_rwf_t;
+#endif
+
/*
* IO submission data structure (Submission Queue Entry)
*/
Found difference in MANIFEST.MF
, but don't think it's important:
vvd/META-INF/MANIFEST.MF
default/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
-Ant-Version: Apache Ant 1.9.4
-Created-By: 11.0.17+8-LTS (Red Hat, Inc.)
+Ant-Version: Apache Ant 1.10.9
+Created-By: 10.0.2+13 (Azul Systems, Inc.)
Specification-Title: Lightweight Java Game Library - Core
Specification-Version: 3.3.1
Specification-Vendor: lwjgl.org
$ ldd bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so
ldd: warning: you do not have execution permission for `bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so'
bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so)
bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so)
linux-vdso.so.1 => (0x00007ffd687f6000)
librt.so.1 => /lib64/librt.so.1 (0x00007f5ada68c000)
libm.so.6 => /lib64/libm.so.6 (0x00007f5ada38a000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f5ada186000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5ad9f6a000)
libc.so.6 => /lib64/libc.so.6 (0x00007f5ad9b9c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5adab12000)
$ ls -l bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so
-rw-r--r-- 1 root root 373744 Feb 21 2022 bin/libs/native/linux/x64/org/lwjgl/glfw/libglfw.so
WHAT?! Why this file downloaded during build instead of build?!
Do you use master branch of https://github.com/glfw/glfw for release?! How do you build it?
$ cmake3 -S . -B . -D BUILD_SHARED_LIBS=ON && make
…
[ 1%] Building C object src/CMakeFiles/glfw.dir/posix_time.c.o
/build/glfw-master/src/posix_time.c: In function '_glfwPlatformInitTimer':
/build/glfw-master/src/posix_time.c:43:31: error: 'CLOCK_REALTIME' undeclared (first use in this function); did you mean '_XOPEN_REALTIME'?
_glfw.timer.posix.clock = CLOCK_REALTIME;
^~~~~~~~~~~~~~
_XOPEN_REALTIME
/build/glfw-master/src/posix_time.c:43:31: note: each undeclared identifier is reported only once for each function it appears in
/build/glfw-master/src/posix_time.c:48:9: warning: implicit declaration of function 'clock_gettime'; did you mean 'localtime'? [-Wimplicit-function-declaration]
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
^~~~~~~~~~~~~
localtime
/build/glfw-master/src/posix_time.c:48:23: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
^~~~~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/glfw.dir/build.make:265: src/CMakeFiles/glfw.dir/posix_time.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:270: src/CMakeFiles/glfw.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
Added #define _POSIX_C_SOURCE 199309L
as 1st line in src/posix_time.c - build fine.
But application run with error window:
GLFW error 65543: GLX: Failed to create context: BadMatch (invalid parameter attributes).
Please make sure you have up-to-date drivers (see aka.ms/mcdriver for instructions).
And messages in console:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
<log4j:Event logger="net.minecraft.client.main.Main" timestamp="1673784648772" level="WARN" thread="Render thread">
<log4j:Message><![CDATA[Failed to create window: ]]></log4j:Message>
<log4j:Throwable><![CDATA[edh$a: GLFW error 65543: GLX: Failed to create context: BadMatch (invalid parameter attributes)
at edh.b(SourceFile:218)
at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43)
at org.lwjgl.system.JNI.invokePPPP(Native Method)
at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2024)
at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2197)
at edh.<init>(SourceFile:93)
at fek.a(SourceFile:21)
at ejf.<init>(SourceFile:490)
at net.minecraft.client.main.Main.a(SourceFile:205)
at net.minecraft.client.main.Main.main(SourceFile:51)
Previous version of the same application run fine with bundled lwjgl 3.2.2. But current version require lwjgl 3.3+.
Hey @VVD,
I'm sorry about the troubles you're having. Unfortunately, it's become impossible to build LWJGL (and all its dependencies) on older Ubuntu systems. Github does not even offer a CI runner with Ubuntu 16 and even 18 is getting deprecated soon. That's why we basically require a newer glibc version (which is already 5 years old btw).
On LWJGL's side, your best bet is simply disabling the liburing bindings and commenting out any functions that are not available on your system. I'm talking about the Kotlin template code that defines the bindings. Run the generator again and they'll be gone, you should then be able to build LWJGL on your system.
For dependencies like GLFW, I can't help I'm afraid. They may be fixable with some simple patches. See this account, it includes all dependencies necessary for LWJGL. The latest commit in every project contains all the LWJGL-specific changes (or just the Github Actions workflow file).
Btw, indeed, the ant release
command by default downloads the prebuilt binaries from LWJGL-CI. If you'd like to test a release with custom binaries, add -Dbuild.offline
to the command.
Finally, a stupid question probably but, why don't you upgrade to CentOS 8?
@VVD GLFW development is far too slow to not build from the master branch. It can take years between the releases.
Finally, a stupid question probably but, why don't you upgrade to CentOS 8?
@Spasi, I'm run software on FreeBSD with Linux environment based on CentOS 7 - no other choice.
Hey @VVD,
LWJGL 3.3.2-snapshot+11
is now available. The x64 build should run fine on CentOS 7, or any other Linux distribution with GLIBC 2.17 or later.
LWJGL binaries are now built inside a base CentOS 7 container, running on the ubuntu-latest
GitHub Actions runner. The magic that unlocked this possibility is provided by centos-release-scl
and devtoolset-11-gcc-c++
. It somehow works with the old GLIBC in CentOS 7 and can build all LWJGL dependencies without trouble. All LWJGL-CI projects have been updated, for details see the lwjgl.yml
files in each repo.
Please let me know how testing goes.
Btw, I've not been able to find a similar solution to cross-compile the arm32/arm64 artifacts. If anyone knows a way, please contact me.
Ping @VVD, any luck with the latest snapshot?
@Spasi, thanks a lot! I'm very busy at work - will test as soon as get time! Where I can download binary "package"? Or I have to build it self?
@VVD Hey, you can get the latest snapshot (direct download or via Maven/Gradle) from https://www.lwjgl.org/customize, just click on the Early Access tab.
Thanks. Trying to run…
Part of start log:
<log4j:Event logger="ejf" timestamp="1680483380640" level="INFO" thread="Render thread">
<log4j:Message><![CDATA[Backend library: LWJGL version 3.3.2-snapshot+13]]></log4j:Message>
</log4j:Event>
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
<log4j:Message><![CDATA[Failed to create window: ]]></log4j:Message>
<log4j:Throwable><![CDATA[edh$a: GLFW error 65543: GLX: Failed to create context: BadMatch (invalid parameter attributes)
at edh.b(SourceFile:218)
at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43)
at org.lwjgl.system.JNI.invokePPPP(Native Method)
at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
Hey @VVD,
Based on the above, the LWJGL core and GLFW native libraries seem to be loading and executing properly, so the GLIBC issue is fixed. There's nothing LWJGL can do about the error you're seeing, looks like there's no OpenGL driver available. Does glxgears
work on that machine?
Hello, @Spasi! Ofc work. Old version of the same application with 3.2.2 work fine and other OpenGL applications work too. Newer version of the application require LWJGL 3.3.1+ and show this error after replace bundled 3.3.1 with 3.3.2-nightly.
Thanks for help!
The failed to load driver: swrast
message seems to suggest that a Mesa driver is being picked up somehow. See this for example: https://askubuntu.com/questions/834254/steam-libgl-error-no-matching-fbconfigs-or-visuals-found-libgl-error-failed-t
LWJGL's method to load the OpenGL driver hasn't changed since 3.3.1. You can verify which library is being loaded by running the application with -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugLoader=true
.
I do see a change in GLFW though, with this commit: https://github.com/glfw/glfw/commit/c18851f52ec9704eb06464058a600845ec1eada1. If libGLX.so.0
is available in your system and GLFW is indeed loading it, you can override that by calling GLFWNativeGLX.setPath(GL.getFunctionProvider());
before initializing GLFW.
LWJGL's method to load the OpenGL driver hasn't changed since 3.3.1. You can verify which library is being loaded by running the application with -Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugLoader=true.
[LWJGL] Loading library: glfw Module: org.lwjgl.glfw Using SharedLibraryLoader... Found at: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/libglfw.so Loaded from org.lwjgl.librarypath: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/libglfw.so <log4j:Event logger="ejf" timestamp="1680525606302" level="INFO" thread="Render thread"> <log4j:Message><![CDATA[Backend library: LWJGL version 3.3.2-snapshot+13]]></log4j:Message> </log4j:Event> [LWJGL] Java 9 check intrinsics enabled [LWJGL] Closure Registry: ConcurrentHashMap libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast [LWJGL] Java 10 multiplyHigh enabled [LWJGL] Java 9 text decoding enabled [LWJGL] Loading JNI library: lwjgl_tinyfd Module: org.lwjgl.tinyfd Using SharedLibraryLoader... Found at: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/liblwjgl_tinyfd.so Loaded from org.lwjgl.librarypath: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/liblwjgl_tinyfd.so … <log4j:Message><![CDATA[Failed to create window: ]]></log4j:Message> <log4j:Throwable><![CDATA[edh$a: GLFW error 65543: GLX: Failed to create context: BadMatch (invalid parameter attributes) at edh.b(SourceFile:218) at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43) at org.lwjgl.system.JNI.invokePPPP(Native Method) at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058) at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
The failed to load driver: swrast message seems to suggest that a Mesa driver is being picked up somehow. See this for example: https://askubuntu.com/questions/834254/steam-libgl-error-no-matching-fbconfigs-or-visuals-found-libgl-error-failed-t After:
mv /usr/compat/linux/usr/lib64/libGLX_mesa.so.0.0.0 /usr/compat/linux/usr/lib64/libGLX_mesa.so.0.0.0_ mv /usr/compat/linux/usr/lib/libGLX_mesa.so.0.0.0 /usr/compat/linux/usr/lib/libGLX_mesa.so.0.0.0_
I got:
[LWJGL] Loading library: glfw Module: org.lwjgl.glfw Using SharedLibraryLoader... Found at: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/libglfw.so Loaded from org.lwjgl.librarypath: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/libglfw.so <log4j:Event logger="ejf" timestamp="1680525606302" level="INFO" thread="Render thread"> <log4j:Message><![CDATA[Backend library: LWJGL version 3.3.2-snapshot+13]]></log4j:Message> </log4j:Event> [LWJGL] Java 9 check intrinsics enabled [LWJGL] Closure Registry: ConcurrentHashMap libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast [LWJGL] Java 10 multiplyHigh enabled [LWJGL] Java 9 text decoding enabled [LWJGL] Loading JNI library: lwjgl_tinyfd Module: org.lwjgl.tinyfd Using SharedLibraryLoader... Found at: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/liblwjgl_tinyfd.so Loaded from org.lwjgl.librarypath: /tmp/lwjgl_user/3.3.2-snapshot+13/x64/liblwjgl_tinyfd.so … <log4j:Message><![CDATA[Failed to create window: ]]></log4j:Message> <log4j:Throwable><![CDATA[edh$a: GLFW error 65545: GLX: Failed to find a suitable GLXFBConfig at edh.b(SourceFile:218) at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:43) at org.lwjgl.system.JNI.invokePPPP(Native Method) at org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058) at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
Changed message in 2nd part.
I do see a change in GLFW though, with this commit: https://github.com/glfw/glfw/commit/c18851f52ec9704eb06464058a600845ec1eada1. If libGLX.so.0 is available in your system and GLFW is indeed loading it, you can override that by calling GLFWNativeGLX.setPath(GL.getFunctionProvider()); before initializing GLFW. It's not my application. It's binary distributed application. Decompile, patch and recompile… don't really want to do this…
Then maybe try building and running the HelloWorld
sample from https://www.lwjgl.org/guide? See if that reproduces the issue and if GLFWNativeGLX.setPath(GL.getFunctionProvider())
fixes it.
Thanks a lot!
HelloWorld.sh:
#!/bin/sh
LWJGL=lwjgl-nightly/lwjgl-glfw.jar:lwjgl-nightly/lwjgl-glfw-natives-linux.jar:lwjgl-nightly/lwjgl-jemalloc-natives-linux.jar:lwjgl-nightly/lwjgl-jemalloc.jar:lwjgl-nightly/lwjgl-natives-linux.jar:lwjgl-nightly/lwjgl-openal-natives-linux.jar:lwjgl-nightly/lwjgl-openal.jar:lwjgl-nightly/lwjgl-opengl-natives-linux.jar:lwjgl-nightly/lwjgl-opengl.jar:lwjgl-nightly/lwjgl-stb-natives-linux.jar:lwjgl-nightly/lwjgl-stb.jar:lwjgl-nightly/lwjgl-tinyfd-natives-linux.jar:lwjgl-nightly/lwjgl-tinyfd.jar:lwjgl-nightly/lwjgl.jar
path/java/bin/javac -cp ${LWJGL} HelloWorld.java
path/java/bin/java -cp .:${LWJGL} HelloWorld
$ ./HelloWorld.sh
Hello LWJGL 3.3.2-snapshot+13!
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
[LWJGL] GLFW_VERSION_UNAVAILABLE error
Description : GLX: Failed to create context: BadValue (integer parameter out of range for operation)
Stacktrace :
org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
HelloWorld.init(HelloWorld.java:49)
HelloWorld.run(HelloWorld.java:22)
HelloWorld.main(HelloWorld.java:112)
Exception in thread "main" java.lang.RuntimeException: Failed to create the GLFW window
at HelloWorld.init(HelloWorld.java:51)
at HelloWorld.run(HelloWorld.java:22)
at HelloWorld.main(HelloWorld.java:112)
Add your patch:
--- HelloWorld.java.orig
+++ HelloWorld.java
@@ -109,6 +109,7 @@
}
public static void main(String[] args) {
+ GLFWNativeGLX.setPath(GL.getFunctionProvider());
new HelloWorld().run();
}
$ ./HelloWorld.sh
Hello LWJGL 3.3.2-snapshot+13!
And I see red window now!!!
Maybe you have tips how to "fix" application? :-o
OK, great, that verifies that the problem is GLFW loading libGLX.so.0
instead of libGL.so.1
.
You first need to understand why that doesn't work. Maybe something is broken on your system? Have you tried reinstalling mesa and your GPU driver? Note that it doesn't matter that LWJGL doesn't try to load libGLX because the application crashes on GLFW window creation, before LWJGL's GL code runs.
Btw, libGLX comes from https://github.com/NVIDIA/libglvnd.
Assuming that is fixed, without changing LWJGL or the application, you could run the application with -Dorg.lwjgl.opengl.libname=libGLX.so.0
. This will ensure that GLFW and LWJGL load the same OpenGL library.
It's kind of late now that 3.3.2 has been released. In the first 3.3.3 snapshot, I could add a command line flag that makes LWJGL call GLFWNativeGLX.setPath(GL.getFunctionProvider())
internally on glfwInit
. This would let you run the unmodified application by forcing GLFW to load libGL.so.1
directly.
Maybe -Dorg.lwjgl.opengl.libname=libGL.so.1
? Tried different values without success.
But mv libGLX.so.0.0.0 libGLX.so.0.0.0_
fixed run of this application!!!
Thanks!!!
Hope developers will update embedded LWJGL to 3.3.3 soon…
My system is FreeBSD 13.1 amd64 with installed CentOS 7 environment (from ports) in Linuxulator. :-D
Because (AFAIK) LWJGL no longer supports FreeBSD I run Linux application in Linuxulator. :-(
Download lwjgl-nightly-2023-06-26-custom.zip from https://www.lwjgl.org/customize, replace bundled libs with downloaded and application run fine without additional command line arguments!
Btw, I've not been able to find a similar solution to cross-compile the arm32/arm64 artifacts. If anyone knows a way, please contact me.
@Spasi you might be interested in using a different method pioneered by chromium. Reversioning the libc6 symbols on the build system to make gcc link to lower versions of GLIBC. It is affective for building on many projects comprised of C code. I am not sure about C++.
Here is an example implementation for an application built fully on GitHub actions focal amd64 and cross compiled for armhf, arm64, i386, and native amd64. The resulting binaries link to GLIBC 2.17 though in theory you can go even lower.
Question
CentOS 7.9.2009 x86_64 with all updates installed. GLIBC 2.17.
Steps got from different places - can't find instruction:
Without erros:
BUILD SUCCESSFUL
But this one fails:
gcc 4.8, no
stdatomic.h
, no support for-std=gnu++14
… Installeddevtools-11
in/opt/rh/devtoolset-11/root/
, so full path to gcc 11 is/opt/rh/devtoolset-11/root/usr/bin/gcc
.How to say to ant where to search gcc?
And I see one more error:
Can't find glibconfig.h
, but: