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

Incomplete setup for jdk+fx on ubuntu-latest (?) #120

Open
rvullriede opened this issue Dec 10, 2024 · 2 comments
Open

Incomplete setup for jdk+fx on ubuntu-latest (?) #120

rvullriede opened this issue Dec 10, 2024 · 2 comments

Comments

@rvullriede
Copy link

I have a small JavaFX app and researched quite a bit for a reliable way to compile this to native using GraalVM. It's worth noting that the app uses a tiny bit of good old AWT to configure the Taskbar icon.

I've tried a multitude of combinations of:

  1. GraalVM CE (various version)
  2. Gluon Substrate
  3. Libernica NIK

each in combination with:

  1. com.gluonhq:gluonfx-maven-plugin
  2. org.graalvm.buildtools:native-maven-plugin (with and without -Djava.awt.headless=false)

The only working solution (including the tiny AWT piece) is:

  • JavaFX 23.0.1
  • native-maven-plugin with jvmArgs -Djava.awt.headless=false
  • compiled with Libernica NIC 21 (jdk+fx)

I've set this up using Github Actions using the following config:

uses: graalvm/setup-graalvm@v1
with:
  distribution: 'liberica'
  java-version: '21'
  java-package: 'jdk+fx'
  cache: 'maven'

for the following os:

matrix:
      os: [ macos-14, macos-13, windows-latest, ubuntu-latest ] # macos-14 is arch, macos-3 is x64

This works without any problems for macos-14, macos-13, windows-latest but it fails for ubuntu-latest with the following error:

[INFO] Executing: /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/bin/native-image -cp /home/runner/work/log-gazer/log-gazer/target/log-gazer-1.2.0.jar:/home/runner/.m2/repository/org/openjfx/javafx-controls/23.0.1/javafx-controls-23.0.1.jar:/home/runner/.m2/repository/org/openjfx/javafx-controls/23.0.1/javafx-controls-23.0.1-linux.jar:/home/runner/.m2/repository/org/openjfx/javafx-graphics/23.0.1/javafx-graphics-23.0.1.jar:/home/runner/.m2/repository/org/openjfx/javafx-graphics/23.0.1/javafx-graphics-23.0.1-linux.jar:/home/runner/.m2/repository/org/openjfx/javafx-base/23.0.1/javafx-base-23.0.1.jar:/home/runner/.m2/repository/org/openjfx/javafx-base/23.0.1/javafx-base-23.0.1-linux.jar:/home/runner/.m2/repository/org/fxmisc/richtext/richtextfx/0.11.4/richtextfx-0.11.4.jar:/home/runner/.m2/repository/org/reactfx/reactfx/2.0-M5/reactfx-2.0-M5.jar:/home/runner/.m2/repository/org/fxmisc/undo/undofx/2.1.1/undofx-2.1.1.jar:/home/runner/.m2/repository/org/fxmisc/flowless/flowless/0.7.3/flowless-0.7.3.jar:/home/runner/.m2/repository/org/fxmisc/wellbehaved/wellbehavedfx/0.3.3/wellbehavedfx-0.3.3.jar:/home/runner/.m2/repository/org/apache/commons/commons-compress/1.27.1/commons-compress-1.27.1.jar:/home/runner/.m2/repository/commons-codec/commons-codec/1.17.1/commons-codec-1.17.1.jar:/home/runner/.m2/repository/commons-io/commons-io/2.16.1/commons-io-2.16.1.jar:/home/runner/.m2/repository/org/apache/commons/commons-lang3/3.16.0/commons-lang3-3.16.0.jar:/home/runner/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.18.2/jackson-databind-2.18.2.jar:/home/runner/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.18.2/jackson-annotations-2.18.2.jar:/home/runner/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.18.2/jackson-core-2.18.2.jar:/home/runner/.m2/repository/org/slf4j/slf4j-api/2.0.16/slf4j-api-2.0.16.jar:/home/runner/.m2/repository/ch/qos/logback/logback-classic/1.5.12/logback-classic-1.5.12.jar:/home/runner/.m2/repository/ch/qos/logback/logback-core/1.5.12/logback-core-1.5.12.jar:/home/runner/work/log-gazer/log-gazer/target/log-gazer-1.2.0.jar:/home/runner/.m2/repository/org/openjfx/javafx-controls/23.0.1/javafx-controls-23.0.1.jar:/home/runner/.m2/repository/org/openjfx/javafx-controls/23.0.1/javafx-controls-23.0.1-linux.jar:/home/runner/.m2/repository/org/openjfx/javafx-graphics/23.0.1/javafx-graphics-23.0.1.jar:/home/runner/.m2/repository/org/openjfx/javafx-graphics/23.0.1/javafx-graphics-23.0.1-linux.jar:/home/runner/.m2/repository/org/openjfx/javafx-base/23.0.1/javafx-base-23.0.1.jar:/home/runner/.m2/repository/org/openjfx/javafx-base/23.0.1/javafx-base-23.0.1-linux.jar:/home/runner/.m2/repository/org/fxmisc/richtext/richtextfx/0.11.4/richtextfx-0.11.4.jar:/home/runner/.m2/repository/org/reactfx/reactfx/2.0-M5/reactfx-2.0-M5.jar:/home/runner/.m2/repository/org/fxmisc/undo/undofx/2.1.1/undofx-2.1.1.jar:/home/runner/.m2/repository/org/fxmisc/flowless/flowless/0.7.3/flowless-0.7.3.jar:/home/runner/.m2/repository/org/fxmisc/wellbehaved/wellbehavedfx/0.3.3/wellbehavedfx-0.3.3.jar:/home/runner/.m2/repository/org/apache/commons/commons-compress/1.27.1/commons-compress-1.27.1.jar:/home/runner/.m2/repository/commons-codec/commons-codec/1.17.1/commons-codec-1.17.1.jar:/home/runner/.m2/repository/commons-io/commons-io/2.16.1/commons-io-2.16.1.jar:/home/runner/.m2/repository/org/apache/commons/commons-lang3/3.16.0/commons-lang3-3.16.0.jar:/home/runner/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.18.2/jackson-databind-2.18.2.jar:/home/runner/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.18.2/jackson-annotations-2.18.2.jar:/home/runner/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.18.2/jackson-core-2.18.2.jar:/home/runner/.m2/repository/org/slf4j/slf4j-api/2.0.16/slf4j-api-2.0.16.jar:/home/runner/.m2/repository/ch/qos/logback/logback-classic/1.5.12/logback-classic-1.5.12.jar:/home/runner/.m2/repository/ch/qos/logback/logback-core/1.5.12/logback-core-1.5.12.jar --no-fallback -o /home/runner/work/log-gazer/log-gazer/target/log-gazer -J-Djava.awt.headless=false -H:ConfigurationFileDirectories=/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/com.fasterxml.jackson.core/jackson-databind/2.15.2,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/org.apache.commons/commons-compress/1.23.0,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/ch.qos.logback/logback-classic/1.4.9,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/org.apache.commons/commons-compress/1.23.0,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/com.fasterxml.jackson.core/jackson-databind/2.15.2,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/ch.qos.logback/logback-classic/1.4.9,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/com.fasterxml.jackson.core/jackson-databind/2.15.2,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/org.apache.commons/commons-compress/1.23.0,/home/runner/work/log-gazer/log-gazer/target/graalvm-reachability-metadata/208e858a947021d0c9c8859df3739e48bdc29f5f/ch.qos.logback/logback-classic/1.4.9 net.osslabz.loggazer.LogGazerApp
========================================================================================================================
GraalVM Native Image: Generating 'log-gazer' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                    (5.7s @ 0.11GB)
 Java version: 21.0.5+11-LTS, vendor version: Liberica-NIK-23.1.5-1
 Graal compiler: optimization level: 2, target machine: x86-64-v3
 C compiler: gcc (linux, x86_64, 11.4.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 1 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 10.57GB of memory (67.7% of 15.61GB system memory, determined at start)
 - 4 thread(s) (100.0% of 4 available processor(s), determined at start)
[2/8] Performing analysis...  [******]                                                                  (69.9s @ 1.98GB)
   17,170 reachable types   (88.5% of   19,396 total)
   34,528 reachable fields  (69.5% of   49,666 total)
   93,764 reachable methods (63.6% of  147,417 total)
    4,942 types,   308 fields, and 2,890 methods registered for reflection
      207 types,   314 fields, and   242 methods registered for JNI access
       26 native libraries: GL, X11, Xtst, atk-1.0, cairo, cairo-gobject, dl, fontconfig, freetype, gdk-3, gdk_pixbuf-2.0, gio-2.0, glib-2.0, gmodule-2.0, gobject-2.0, gthread-2.0, gtk-3, harfbuzz, m, pango-1.0, pangocairo-1.0, pangoft2-1.0, pthread, rt, stdc++, z
[3/8] Building universe...                                                                               (8.2s @ 2.02GB)
[4/8] Parsing methods...      [***]                                                                      (7.0s @ 2.05GB)
[5/8] Inlining methods...     [****]                                                                     (5.3s @ 2.28GB)
[6/8] Compiling methods...    [********]                                                                (66.0s @ 1.54GB)
[7/8] Layouting methods...    [***]                                                                      (6.8s @ 2.16GB)

[8/8] Creating image...       [***]                                                                      (0.0s @ 2.45GB)
------------------------------------------------------------------------------------------------------------------------
                       17.1s (9.6% of total time) in 1466 GCs | Peak RSS: 4.75GB | CPU load: 3.57
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /home/runner/work/log-gazer/log-gazer/target/svm_err_b_20241209T190327.176_pid1903.md (build_info)
========================================================================================================================
Failed generating 'log-gazer' after 2m 57s.

The build process encountered an unexpected error:

> java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Based on the linker command output, possible reasons for this include:
1. It appears as though libGL:.a is missing. Please install it.

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--version-script,/tmp/SVM-12370334894227265437/exported_symbols.list -Wl,-x -o /home/runner/work/log-gazer/log-gazer/target/log-gazer log-gazer.o /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libnet.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_font_pango.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libglassgtk3.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libextnet.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_font_freetype.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libnio.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_font.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_iio.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjava.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libprefs.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libprism_es2.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libglass.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libzip.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64/libjvm.a -Wl,--export-dynamic -v -L/tmp/SVM-12370334894227265437 -L/opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc -L/opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64 -lm -lstdc++ -lX11 -lXtst -lfontconfig -lfreetype -lharfbuzz -lgtk-3 -lgdk-3 -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lgdk_pixbuf-2.0 -lcairo -lcairo-gobject -lpango-1.0 -lpangocairo-1.0 -lpangoft2-1.0 -latk-1.0 -lGL -lz -ldl -lpthread -lrt -Wl,-u,JNU_CallMethodByName -Wl,-u,JNU_CallStaticMethodByName -Wl,-u,JNU_GetEnv -Wl,-u,JNU_GetStaticFieldByName -Wl,-u,JNU_GetStringPlatformChars -Wl,-u,JNU_IsInstanceOfByName -Wl,-u,JNU_NewObjectByName -Wl,-u,JNU_NewStringPlatform -Wl,-u,JNU_ReleaseStringPlatformChars -Wl,-u,JNU_SetFieldByName -Wl,-u,JNU_ThrowArrayIndexOutOfBoundsException -Wl,-u,JNU_ThrowByName -Wl,-u,JNU_ThrowIllegalArgumentException -Wl,-u,JNU_ThrowInternalError -Wl,-u,JNU_ThrowNullPointerException -Wl,-u,JNU_ThrowOutOfMemoryError -Wl,-u,JNI_CreateJavaVM -Wl,-u,JNI_GetCreatedJavaVMs -Wl,-u,JNI_GetDefaultJavaVMInitArgs -Wl,-u,jio_fprintf -Wl,-u,jio_snprintf

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/runner/work/log-gazer/log-gazer/target/log-gazer' '-v' '-L/tmp/SVM-12370334894227265437' '-L/opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc' '-L/opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/runner/work/log-gazer/log-gazer/target/log-gazer.'
 /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccEYG9BQ.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o /home/runner/work/log-gazer/log-gazer/target/log-gazer -z noexecstack /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o -L/tmp/SVM-12370334894227265437 -L/opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc -L/opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. --gc-sections --version-script /tmp/SVM-12370334894227265437/exported_symbols.list -x log-gazer.o /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libnet.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_font_pango.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libglassgtk3.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libextnet.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_font_freetype.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libnio.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_font.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjavafx_iio.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64/liblibchelper.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libjava.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libprefs.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libprism_es2.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libglass.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/static/linux-amd64/glibc/libzip.a /opt/hostedtoolcache/bellsoft-liberica-vm-full-linux-amd64/21.0.0/x64/bellsoft-liberica-vm-full-openjdk21-23.1.5/lib/svm/clibraries/linux-amd64/libjvm.a --export-dynamic -lm -lstdc++ -lX11 -lXtst -lfontconfig -lfreetype -lharfbuzz -lgtk-3 -lgdk-3 -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lgdk_pixbuf-2.0 -lcairo -lcairo-gobject -lpango-1.0 -lpangocairo-1.0 -lpangoft2-1.0 -latk-1.0 -lGL -lz -ldl -lpthread -lrt -u JNU_CallMethodByName -u JNU_CallStaticMethodByName -u JNU_GetEnv -u JNU_GetStaticFieldByName -u JNU_GetStringPlatformChars -u JNU_IsInstanceOfByName -u JNU_NewObjectByName -u JNU_NewStringPlatform -u JNU_ReleaseStringPlatformChars -u JNU_SetFieldByName -u JNU_ThrowArrayIndexOutOfBoundsException -u JNU_ThrowByName -u JNU_ThrowIllegalArgumentException -u JNU_ThrowInternalError -u JNU_ThrowNullPointerException -u JNU_ThrowOutOfMemoryError -u JNI_CreateJavaVM -u JNI_GetCreatedJavaVMs -u JNI_GetDefaultJavaVMInitArgs -u jio_fprintf -u jio_snprintf -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: cannot find -lXtst: No such file or directory
/usr/bin/ld: cannot find -lharfbuzz: No such file or directory
/usr/bin/ld: cannot find -lgtk-3: No such file or directory
/usr/bin/ld: cannot find -lgdk-3: No such file or directory
/usr/bin/ld: cannot find -lpango-1.0: No such file or directory
/usr/bin/ld: cannot find -lpangocairo-1.0: No such file or directory
/usr/bin/ld: cannot find -lpangoft2-1.0: No such file or directory
/usr/bin/ld: cannot find -latk-1.0: No such file or directory
/usr/bin/ld: cannot find -lGL: No such file or directory
collect2: error: ld returned 1 exit status

You'll find the complete action here:
https://github.com/osslabz/log-gazer/blob/dev/.github/workflows/build-release-on-main-push.yml

and the complete run log here:

https://github.com/osslabz/log-gazer/actions/runs/12242211892/job/34149026394

I'm not quite sure if this is actually a problem with graalvm/setup-graalvm or maybe with the OS image itself or the Libernica NIC but since the setup is identical for all OS I'd naively assume it should work the same for all.

If you think this should be better addressed somewhere else, please point me to the right direction, thanks!

@rvullriede
Copy link
Author

I found a workaround with a conditional step, that allows me to compile (binary testing is pending):

- id: install-libs
  if: runner.os == 'Linux'
  run: |
    sudo apt-get update
    sudo apt-get -y install libxtst-dev libharfbuzz-dev libgtk-3-dev libpango1.0-dev libatk1.0-dev libgl1-mesa-dev libx11-dev libfreetype6-dev libfontconfig1-dev

Nonetheless, I'm wondering it that should be required or of one could expect this to work out of the box....

@fniephaus
Copy link
Member

Hi @rvullriede,
thanks for raising this. I haven't seen this error before, but I have compiled AWT-based apps with GraalVM on GitHub actions without installing additional dependencies.
If I get the error right, it seems that additional dependencies like libGL, pango, etc are required, and it seems that's due to JavaFX. I'm not too familiar with JavaFX dependencies, but if that's true, we could add a feature to setup-graalvm that installs JavaFX native dependencies.

You mentioned that you only got this working with Liberica and that's probably only because they ship reachability metadata for AWT. It should also work with other distributions, like GraalVM CE or Oracle GraalVM, if you use the Tracing Agent to collect reachability metadata for your application. This can arguably be a bit annoying because you'd need to run it on all platforms as AWT is platform-specific. However, the metadata in Liberica is not specific to your app and may very well pull in a lot more code than actually is needed. So if you use the tracing agent, you may even get smaller binaries.

Here's a blog post that explains how to do this on Windows:
https://medium.com/db-one/building-javafx-app-native-image-with-graalvm-new-achievement-unlocked-c5e236ecf11d

Hope this helps!

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

No branches or pull requests

2 participants