androidlinuxmavenjavafxgluon

Undefined reference at graalvm link task with gluonfx-maven-plugin


I've searched the web hours about my question and testing many things without finding any solution.

I have a JavaFX application handled by maven and developped under VSCode. I want it to be available as a desktop app, an Android app and a IOS app.

In order to do that, I chose to use gluonfx-maven-plugin and downloaded the corresponding graalvm version with my java version (graalvm-svm-java11-linux-gluon-22.1.0.1-Final). Nevertheless, even though gcc and ld are up to date, I encounter link issues I am unable to resolve. Would you have any idea that could help me?

[Sun Aug 14 22:38:45 CEST 2022][INFO] ==================== LINK TASK ====================
[Sun Aug 14 22:38:46 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1660509375916/menu.main.o:(.data+0x448): undefined reference to `Java_com_sun_security_auth_module_UnixSystem_getUnixInfo'
[Sun Aug 14 22:38:46 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1660509375916/menu.main.o:(.data+0xc78): undefined reference to `JNI_OnLoad_jaas'
[Sun Aug 14 22:38:46 CEST 2022][INFO] [SUB] collect2: error: ld returned 1 exit status
[Sun Aug 14 22:38:46 CEST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Sun Aug 14 22:38:46 CEST 2022][INFO] Logging process [link] to file: /home/lambevin/Perso/Character-creator/software/target/gluonfx/log/process-link-1660509526771.log
[Sun Aug 14 22:38:46 CEST 2022][SEVERE] Linking failed.
Check the log files under /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Not gluon-based graalvm installations have issues at the building phase so its even worse...

Here is my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.gitlab.vincent-lambert</groupId>
  <artifactId>Character_Creator</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>

  <name>Character_Creator</name>
  <description>French software to handle Twin Worlds (Mondes Jumeaux) data and create characters</description>
  <url>${project.groupId}:${project.artifactId}</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>11</maven.compiler.release>
    <javafx.version>18.0.2</javafx.version>
    <javafx.plugin.version>0.0.8</javafx.plugin.version>
    <gluonfx.plugin.version>1.0.14</gluonfx.plugin.version>
    <charm.version>6.1.1</charm.version>
    <attach.version>4.0.15</attach.version>
    <main.class>Menu.Main</main.class>
  </properties>

  <repositories>
    <repository>
      <id>charm-glisten</id>
      <name>charm-glisten Repository</name>
      <url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
      <layout>default</layout>
    </repository>
    <repository>
        <id>gluon-releases</id>
        <url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
    </repository>
  </repositories>

  <profiles>
      <profile>
          <id>android</id>
          <properties>
              <gluonfx.target>android</gluonfx.target>
          </properties>
      </profile>
      <profile>
          <id>ios</id>
          <properties>
              <gluonfx.target>ios</gluonfx.target>
          </properties>
      </profile>
  </profiles>
  

  <dependencies>
    <dependency>
      <groupId>org.aerofx</groupId>
      <artifactId>aerofx</artifactId>
      <version>0.2</version>
    </dependency>
    <dependency>
      <groupId>org.jfxcore</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>15-ea+1</version>
    </dependency>

    <dependency>
      <groupId>org.javatuples</groupId>
      <artifactId>javatuples</artifactId>
      <version>1.2</version>
    </dependency>
    
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-base</artifactId>
      <version>${javafx.version}</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-graphics</artifactId>
        <version>${javafx.version}</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>${javafx.version}</version>
    </dependency>

    <dependency>
      <groupId>org.controlsfx</groupId>
      <artifactId>controlsfx</artifactId>
      <version>11.0.3</version>
    </dependency>
    
    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
      <version>2.1.2</version>
    </dependency>

    <dependency>
      <groupId>com.gluonhq</groupId>
      <artifactId>charm-glisten</artifactId>
      <version>${charm.version}</version>
    </dependency>
    <dependency>
        <groupId>com.gluonhq.attach</groupId>
        <artifactId>display</artifactId>
        <version>${attach.version}</version>
    </dependency>
    <dependency>
        <groupId>com.gluonhq.attach</groupId>
        <artifactId>lifecycle</artifactId>
        <version>${attach.version}</version>
    </dependency>
    <dependency>
        <groupId>com.gluonhq.attach</groupId>
        <artifactId>statusbar</artifactId>
        <version>${attach.version}</version>
    </dependency>
    <dependency>
        <groupId>com.gluonhq.attach</groupId>
        <artifactId>storage</artifactId>
        <version>${attach.version}</version>
    </dependency>
    <dependency>
        <groupId>com.gluonhq.attach</groupId>
        <artifactId>util</artifactId>
        <version>${attach.version}</version>
    </dependency>

    <dependency>
      <groupId>com.simtechdata</groupId>
      <artifactId>Switcher</artifactId>
      <version>1.3.6</version>
    </dependency>

    <dependency>
      <groupId>io.gitlab.vincent-lambert</groupId>
      <artifactId>miscellaneousWidgets</artifactId>
      <version>1.1</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
      </plugin>
      <plugin>
          <groupId>org.openjfx</groupId>
          <artifactId>javafx-maven-plugin</artifactId>
          <version>${javafx.plugin.version}</version>
          <configuration>
              <mainClass>${main.class}</mainClass>
          </configuration>
      </plugin>
      <plugin>
          <groupId>com.gluonhq</groupId>
          <artifactId>gluonfx-maven-plugin</artifactId>
          <version>${gluonfx.plugin.version}</version>
          <configuration>
              <target>${gluonfx.target}</target>
              <mainClass>${main.class}</mainClass>
              <attachList>
                  <list>display</list>
                  <list>lifecycle</list>
                  <list>statusbar</list>
                  <list>storage</list>
              </attachList>
          </configuration>
      </plugin>
    </plugins>

    <resources>
        <resource>
            <directory>src/resources</directory>
            <includes>
                <include>fxml/*.fxml</include>
                <include>images/*.png</include>
                <include>images/*.jpg</include>
                <include>CSS/*.css</include>
                <include>fonts/*.ttf</include>
            </includes>
        </resource>
    </resources>
  </build>
</project>

PS: My code environment is WSL2 under windows 11.

PS2: Asked logs which does not add more info...

[Sun Aug 14 22:38:45 CEST 2022][INFO] ==================== LINK TASK ====================
[Sun Aug 14 22:38:45 CEST 2022][FINE] Looking for resource: /native/linux/launcher.c
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for compile-additional-sources: gcc -c -DSUBSTRATE -I/opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/include -I/opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/include/linux -I/home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/Character_Creator launcher.c
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process compile-additional-sources...
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for compile-additional-sources: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for libavcodec: /usr/bin/pkg-config --libs libavcodec
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for libavcodec...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lavcodec
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for libavcodec: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg libavcodec provided flags: [-lavcodec]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for libavformat: /usr/bin/pkg-config --libs libavformat
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for libavformat...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lavformat
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for libavformat: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg libavformat provided flags: [-lavformat]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for libavutil: /usr/bin/pkg-config --libs libavutil
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for libavutil...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lavutil
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for libavutil: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg libavutil provided flags: [-lavutil]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for alsa: /usr/bin/pkg-config --libs alsa
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for alsa...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lasound
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for alsa: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg alsa provided flags: [-lasound]
[Sun Aug 14 22:38:45 CEST 2022][FINE] All flags: [-lgstreamer-lite, -lavcodec, -lavformat, -lavutil, -lasound]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for gl: /usr/bin/pkg-config --libs gl
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for gl...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lGL
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for gl: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg gl provided flags: [-lGL]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for x11: /usr/bin/pkg-config --libs x11
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for x11...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lX11
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for x11: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg x11 provided flags: [-lX11]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for gtk+-x11-3.0: /usr/bin/pkg-config --libs gtk+-x11-3.0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for gtk+-x11-3.0...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for gtk+-x11-3.0: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg gtk+-x11-3.0 provided flags: [-lgtk-3, -lgdk-3, -lpangocairo-1.0, -lpango-1.0, -lharfbuzz, -latk-1.0, -lcairo-gobject, -lcairo, -lgdk_pixbuf-2.0, -lgio-2.0, -lgobject-2.0, -lglib-2.0]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for freetype2: /usr/bin/pkg-config --libs freetype2
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for freetype2...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lfreetype
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for freetype2: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg freetype2 provided flags: [-lfreetype]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for pangoft2: /usr/bin/pkg-config --libs pangoft2
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for pangoft2...
[Sun Aug 14 22:38:45 CEST 2022][FINE] [SUB] -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype
[Sun Aug 14 22:38:45 CEST 2022][FINE] Result for Get config for pangoft2: 0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Pkg pangoft2 provided flags: [-lpangoft2-1.0, -lpango-1.0, -lgobject-2.0, -lglib-2.0, -lharfbuzz, -lfontconfig, -lfreetype]
[Sun Aug 14 22:38:45 CEST 2022][FINE] PB Command for Get config for gthread-2.0: /usr/bin/pkg-config --libs gthread-2.0
[Sun Aug 14 22:38:45 CEST 2022][FINE] Start process Get config for gthread-2.0...
[Sun Aug 14 22:38:46 CEST 2022][FINE] [SUB] -lgthread-2.0 -pthread -lglib-2.0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Result for Get config for gthread-2.0: 0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Pkg gthread-2.0 provided flags: [-lgthread-2.0, -pthread, -lglib-2.0]
[Sun Aug 14 22:38:46 CEST 2022][FINE] PB Command for Get config for zlib: /usr/bin/pkg-config --libs zlib
[Sun Aug 14 22:38:46 CEST 2022][FINE] Start process Get config for zlib...
[Sun Aug 14 22:38:46 CEST 2022][FINE] [SUB] -lz
[Sun Aug 14 22:38:46 CEST 2022][FINE] Result for Get config for zlib: 0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Pkg zlib provided flags: [-lz]
[Sun Aug 14 22:38:46 CEST 2022][FINE] PB Command for Get config for xtst: /usr/bin/pkg-config --libs xtst
[Sun Aug 14 22:38:46 CEST 2022][FINE] Start process Get config for xtst...
[Sun Aug 14 22:38:46 CEST 2022][FINE] [SUB] -lXtst
[Sun Aug 14 22:38:46 CEST 2022][FINE] Result for Get config for xtst: 0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Pkg xtst provided flags: [-lXtst]
[Sun Aug 14 22:38:46 CEST 2022][FINE] PB Command for Get config for gmodule-no-export-2.0: /usr/bin/pkg-config --libs gmodule-no-export-2.0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Start process Get config for gmodule-no-export-2.0...
[Sun Aug 14 22:38:46 CEST 2022][FINE] [SUB] -lgmodule-2.0 -pthread -lglib-2.0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Result for Get config for gmodule-no-export-2.0: 0
[Sun Aug 14 22:38:46 CEST 2022][FINE] Pkg gmodule-no-export-2.0 provided flags: [-lgmodule-2.0, -pthread, -lglib-2.0]
[Sun Aug 14 22:38:46 CEST 2022][FINE] All flags: [-Wl,--no-whole-archive, -lGL, -lX11, -lgtk-3, -lgdk-3, -lpangocairo-1.0, -lpango-1.0, -lharfbuzz, -latk-1.0, -lcairo-gobject, -lcairo, -lgdk_pixbuf-2.0, -lgio-2.0, -lgobject-2.0, -lglib-2.0, -lfreetype, -lpangoft2-1.0, -lpango-1.0, -lgobject-2.0, -lglib-2.0, -lharfbuzz, -lfontconfig, -lfreetype, -lgthread-2.0, -pthread, -lglib-2.0, -lstdc++, -lz, -lXtst, -lm, -lgmodule-2.0, -pthread, -lglib-2.0]
[Sun Aug 14 22:38:46 CEST 2022][FINE] PB Command for link: gcc /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/Character_Creator/launcher.o /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1660509375916/menu.main.o /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libjava.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libnio.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libzip.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libnet.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libprefs.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libj2pkcs11.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libsunec.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libextnet.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libfdlibm.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libfontmanager.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libjavajpeg.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/liblcms.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libawt_headless.a /opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/static/linux-amd64/glibc/libawt.a -l:libjvm.a -l:liblibchelper.a -lz -ldl -lstdc++ -lpthread -Wl,--wrap=pow -rdynamic -lprism_es2 -lglass -lglassgtk3 -ljavafx_font -ljavafx_font_freetype -ljavafx_font_pango -ljavafx_iio -lgstreamer-lite -lavcodec -lavformat -lavutil -lasound -Wl,--no-whole-archive -lGL -lX11 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lgthread-2.0 -pthread -lglib-2.0 -lstdc++ -lz -lXtst -lm -lgmodule-2.0 -pthread -lglib-2.0 -lm -ldl -o /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/Character_Creator -L/opt/graalvm-svm-java11-linux-gluon-22.1.0.1-Final/lib/svm/clibraries/linux-amd64 -L/home/lambevin/.gluon/substrate/javafxStaticSdk/19-ea+8/linux-x86_64/sdk/lib
[Sun Aug 14 22:38:46 CEST 2022][FINE] Start process link...
[Sun Aug 14 22:38:46 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1660509375916/menu.main.o:(.data+0x448): undefined reference to `Java_com_sun_security_auth_module_UnixSystem_getUnixInfo'
[Sun Aug 14 22:38:46 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1660509375916/menu.main.o:(.data+0xc78): undefined reference to `JNI_OnLoad_jaas'
[Sun Aug 14 22:38:46 CEST 2022][INFO] [SUB] collect2: error: ld returned 1 exit status
[Sun Aug 14 22:38:46 CEST 2022][FINE] Result for link: 1
[Sun Aug 14 22:38:46 CEST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Sun Aug 14 22:38:46 CEST 2022][INFO] Logging process [link] to file: /home/lambevin/Perso/Character-creator/software/target/gluonfx/log/process-link-1660509526771.log
[Sun Aug 14 22:38:46 CEST 2022][SEVERE] Linking failed.
Check the log files under /home/lambevin/Perso/Character-creator/software/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.

Solution

  • just adding the details to @pereda comment above which is the actual correct answer

    this issue provides a context.

    Perhaps best fix is to use the linkerArgs tag in the configuration block of the gluonfx-maven-plugin section of the pom.xml, looks like this on linux

    <linkerArgs>
        <arg>
           {path to the gluon graalvm folder}/lib/static/linux-amd64/glibc/libjaas.a
        </arg>
    </linkerArgs>
    

    Notes
    on ubuntu 22.04 I had two link errors

    undefined reference to `Java_com_sun_security_auth_module_UnixSystem_getUnixInfo'
    
    undefined reference to `JNI_OnLoad_jaas'
    

    the above argument to the linkerArgs resolved both errors