Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build 3.3.1 on CentOS 7 #842

Closed
VVD opened this issue Jan 3, 2023 · 28 comments
Closed

Build 3.3.1 on CentOS 7 #842

VVD opened this issue Jan 3, 2023 · 28 comments

Comments

@VVD
Copy link

VVD commented Jan 3, 2023

Question

CentOS 7.9.2009 x86_64 with all updates installed. GLIBC 2.17.

* Linux: Shared libraries are now built on Ubuntu 18.04 (up from Ubuntu 16.04) (B)
    - GLIBC versions older than 2.14 are no longer supported. Some, but not all, LWJGL natives may require up to GLIBC 2.27.
    - Applications deployed on older systems must now build & bundle custom LWJGL natives. Contact LWJGL developers if you need assistance.

Steps got from different places - can't find instruction:

wget https://github.com/LWJGL/lwjgl3/archive/refs/tags/3.3.1.tar.gz
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 JAVA_HOME=/usr/lib/jvm/java-11-openjdk/bin/java
ant compile-templates
ant generate
ant compile

Without erros: BUILD SUCCESSFUL

But this one fails:

ant compile-native
Buildfile: /root/lwjgl3-3.3.1/build.xml

init:
 [override] Build type: release/3.3.1

check-dependencies:

generate:

compile:

compile-native:
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64

compile-native-platform:
 [Compiler] gcc --version: "gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)"
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/core
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/lmdb
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/libdivide
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/llvm
      [gcc] Linking lwjgl_libdivide
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/libdivide
 [Compiler] In file included from ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h:20:0,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/syscall.h:14,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/queue.c:5:
 [Compiler] ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/barrier.h:56:23: фатальная ошибка: stdatomic.h: Нет такого файла или каталога
 [Compiler]  #include <stdatomic.h>
 [Compiler]                        ^
 [Compiler] компиляция прервана.
      [gcc] Linking lwjgl_llvm
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/llvm
 [Compiler] In file included from ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h:20:0,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/syscall.h:14,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/register.c:5:
 [Compiler] ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/barrier.h:56:23: фатальная ошибка: stdatomic.h: Нет такого файла или каталога
 [Compiler]  #include <stdatomic.h>
 [Compiler]                        ^
 [Compiler] компиляция прервана.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/lz4
 [Compiler] In file included from ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h:20:0,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/syscall.h:14,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/setup.c:5:
 [Compiler] ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/barrier.h:56:23: фатальная ошибка: stdatomic.h: Нет такого файла или каталога
 [Compiler]  #include <stdatomic.h>
 [Compiler]                        ^
 [Compiler] компиляция прервана.
 [Compiler] In file included from ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h:20:0,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/syscall.h:14,
 [Compiler]                  from /root/lwjgl3-3.3.1/modules/lwjgl/core/src/main/c/linux/liburing/syscall.c:22:
 [Compiler] ../../../../modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/barrier.h:56:23: фатальная ошибка: stdatomic.h: Нет такого файла или каталога
 [Compiler]  #include <stdatomic.h>
 [Compiler]                        ^
 [Compiler] компиляция прервана.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/meow
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/meshoptimizer
 [Compiler] g++: ошибка: unrecognized command line option «-std=gnu++14»
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/nanovg
      [gcc] Linking lwjgl_meow
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/meow
 [Compiler] In file included from /root/lwjgl3-3.3.1/modules/lwjgl/nanovg/src/generated/c/org_lwjgl_nanovg_Blendish.c:11:0:
 [Compiler] ../../../../modules/lwjgl/nanovg/src/main/c/blendish.h: В функции «bndJoinAreaOverlay»:
 [Compiler] ../../../../modules/lwjgl/nanovg/src/main/c/blendish.h:1894:5: ошибка: «for» loop initial declarations are only allowed in C99 mode
 [Compiler]      for (int i = 1; i < count; ++i) {
 [Compiler]      ^
 [Compiler] компиляция прервана из-за -Wfatal-errors.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/nfd
 [Compiler] In file included from /usr/include/glib-2.0/glib/galloca.h:32:0,
 [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:24: фатальная ошибка: glibconfig.h: Нет такого файла или каталога
 [Compiler]  #include <glibconfig.h>
 [Compiler]                         ^
 [Compiler] компиляция прервана.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/nuklear
      [gcc] Linking lwjgl_lmdb
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/lmdb
      [gcc] Linking lwjgl_lz4
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/lz4
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/opengl
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/opengles
      [gcc] Linking lwjgl_nuklear
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/nuklear
 [Compiler] In file included from /root/lwjgl3-3.3.1/modules/lwjgl/nanovg/src/generated/c/org_lwjgl_nanovg_OUI.c:13:0:
 [Compiler] ../../../../modules/lwjgl/nanovg/src/main/c/oui.h: В функции «uiClear»:
 [Compiler] ../../../../modules/lwjgl/nanovg/src/main/c/oui.h:940:5: ошибка: «for» loop initial declarations are only allowed in C99 mode
 [Compiler]      for (int i = 0; i < ui_context->last_count; ++i) {
 [Compiler]      ^
 [Compiler] компиляция прервана из-за -Wfatal-errors.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/openvr
      [gcc] Linking lwjgl_openvr
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/openvr
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/par
 [Compiler] In file included from /root/lwjgl3-3.3.1/modules/lwjgl/par/src/generated/c/org_lwjgl_util_par_ParOctasphere.c:9:0:
 [Compiler] ../../../../modules/lwjgl/par/src/main/c/par_octasphere.h: В функции «paro_write_geodesic»:
 [Compiler] ../../../../modules/lwjgl/par/src/main/c/par_octasphere.h:227:5: ошибка: «for» loop initial declarations are only allowed in C99 mode
 [Compiler]      for (int point_index = 1; point_index < num_segments; point_index++, dst += 3) {
 [Compiler]      ^
 [Compiler] компиляция прервана из-за -Wfatal-errors.
 [Compiler] In file included from /root/lwjgl3-3.3.1/modules/lwjgl/par/src/generated/c/org_lwjgl_util_par_ParShapes.c:15:0:
 [Compiler] ../../../../modules/lwjgl/par/src/main/c/par_shapes.h: В функции «par_shapes__compute_welded_normals»:
 [Compiler] ../../../../modules/lwjgl/par/src/main/c/par_shapes.h:331:5: ошибка: «for» loop initial declarations are only allowed in C99 mode
 [Compiler]      for (int i = 0; i < m->npoints; i++, pdst += 3) {
 [Compiler]      ^
 [Compiler] компиляция прервана из-за -Wfatal-errors.
 [Compiler] In file included from /root/lwjgl3-3.3.1/modules/lwjgl/par/src/generated/c/org_lwjgl_util_par_ParStreamlines.c:14:0:
 [Compiler] ../../../../modules/lwjgl/par/src/main/c/par_streamlines.h: В функции «parsl_mesh_from_lines»:
 [Compiler] ../../../../modules/lwjgl/par/src/main/c/par_streamlines.h:296:5: ошибка: «for» loop initial declarations are only allowed in C99 mode
 [Compiler]      for (uint32_t spine = 0; spine < spines.num_spines; spine++) {
 [Compiler]      ^
 [Compiler] компиляция прервана из-за -Wfatal-errors.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/remotery
      [gcc] Linking lwjgl_remotery
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/remotery
      [gcc] Linking lwjgl_opengles
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/opengles
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/rpmalloc
 [Compiler] In file included from /root/lwjgl3-3.3.1/modules/lwjgl/rpmalloc/src/generated/c/org_lwjgl_system_rpmalloc_RPmalloc.c:11:0:
 [Compiler] ../../../../modules/lwjgl/rpmalloc/src/main/c/rpmalloc.c:237:23: фатальная ошибка: stdatomic.h: Нет такого файла или каталога
 [Compiler]  #include <stdatomic.h>
 [Compiler]                        ^
 [Compiler] компиляция прервана.
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/sse
      [gcc] Linking lwjgl_sse
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/sse
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/stb
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/tinyexr
 [Compiler] g++: ошибка: unrecognized command line option «-std=gnu++14»
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/tinyfd
      [gcc] Linking lwjgl_opengl
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/opengl
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/tootle
 [Compiler] g++: ошибка: unrecognized command line option «-std=gnu++14»
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/vma
 [Compiler] g++: ошибка: unrecognized command line option «-std=gnu++14»
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/xxhash
      [gcc] Linking lwjgl_tinyfd
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/tinyfd
      [gcc] Linking lwjgl_xxhash
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/xxhash
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/yoga
 [Compiler] g++: ошибка: unrecognized command line option «-std=gnu++14»
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/linux/x64/zstd
      [gcc] Linking lwjgl_stb
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/stb
      [gcc] Linking lwjgl_zstd
    [mkdir] Created dir: /root/lwjgl3-3.3.1/bin/libs/native/linux/x64/org/lwjgl/zstd

BUILD FAILED
/root/lwjgl3-3.3.1/build.xml:565: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:166:
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:168: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:244: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:90: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:269: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:90: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:151: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:90: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:353: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:381: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:90: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1
The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:422: The following error occurred while executing this line:
/root/lwjgl3-3.3.1/config/linux/build.xml:36: apply returned: 1

Total time: 1 minute 32 seconds

gcc 4.8, no stdatomic.h, no support for -std=gnu++14
Installed devtools-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:

$ find /usr/ -name glibconfig.h
/usr/lib64/glib/include/glibconfig.h
/usr/lib64/glib-2.0/include/glibconfig.h
@Spasi
Copy link
Member

Spasi commented Jan 9, 2023

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.

@VVD
Copy link
Author

VVD commented Jan 9, 2023

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
Copy link
Member

Spasi commented Jan 9, 2023

I don't have experience with CentOS, but this makes it sound simple.

@VVD
Copy link
Author

VVD commented Jan 11, 2023

@Spasi
. /opt/rh/devtoolset-11/enable switch default gcc to 11.
Require devtoolset-11-libatomic-devel too.

But there are other errors:

  1. 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?

  1. 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.
  1. 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.

@VVD
Copy link
Author

VVD commented Jan 11, 2023

  1. I don't see any 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;
 }

@VVD
Copy link
Author

VVD commented Jan 11, 2023

  1. Patch:
--- 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
+
 /*
  * IO submission data structure (Submission Queue Entry)
  */

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!

@VVD
Copy link
Author

VVD commented Jan 11, 2023

:-(

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

@VVD
Copy link
Author

VVD commented Jan 15, 2023

$ 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?!

@VVD
Copy link
Author

VVD commented Jan 15, 2023

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+.

@Spasi
Copy link
Member

Spasi commented Jan 31, 2023

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?

@ws909
Copy link

ws909 commented Jan 31, 2023

@VVD GLFW development is far too slow to not build from the master branch. It can take years between the releases.

@VVD
Copy link
Author

VVD commented Feb 17, 2023

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.

@Spasi
Copy link
Member

Spasi commented Mar 13, 2023

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.

@Spasi
Copy link
Member

Spasi commented Mar 13, 2023

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
Copy link
Member

Spasi commented Mar 26, 2023

Ping @VVD, any luck with the latest snapshot?

@Spasi Spasi closed this as completed in 869c37b Mar 27, 2023
@VVD
Copy link
Author

VVD commented Mar 28, 2023

@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?

@Spasi
Copy link
Member

Spasi commented Mar 28, 2023

@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.

@VVD
Copy link
Author

VVD commented Apr 3, 2023

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)

@Spasi
Copy link
Member

Spasi commented Apr 3, 2023

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?

@VVD
Copy link
Author

VVD commented Apr 3, 2023

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!

@Spasi
Copy link
Member

Spasi commented Apr 3, 2023

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: glfw/glfw@c18851f. 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.

@VVD
Copy link
Author

VVD commented Apr 3, 2023

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: glfw/glfw@c18851f. 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…

@Spasi
Copy link
Member

Spasi commented Apr 3, 2023

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.

@VVD
Copy link
Author

VVD commented Apr 3, 2023

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

@Spasi
Copy link
Member

Spasi commented Apr 3, 2023

OK, great, that verifies that the problem is GLFW loading libGLX.so.0 instead of libGL.so.1.

From your side

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.

From LWJGL's side

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.

@VVD
Copy link
Author

VVD commented Apr 3, 2023

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. :-(

@VVD
Copy link
Author

VVD commented Jun 27, 2023

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!

@theofficialgman
Copy link

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.

https://github.com/libgdx/Jamepad/pull/22/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants