gluonhq / gluonfx-maven-plugin

Plugin that simplifies creating native images for Java/JavaFX maven projects
BSD 3-Clause "New" or "Revised" License
189 stars 39 forks source link

Linux: runagent breaks linking #430

Closed ennerf closed 1 year ago

ennerf commented 2 years ago

I'm exploring the state of native compilation and tried building hello-gluon-ci @b9a1c19 on Ubuntu 20.04. The standard build works, but the files generated by running gluonfx:runagent break the linking step. I narrowed it down to some issues in the generated jni-config.json and reflect-config.json. A lot of the documentation and examples are currently broken due to this issue.

Environment

> lsb_release -d
Description:    Ubuntu 20.04.4 LTS

> echo $GRAALVM_HOME
/home/user/Downloads/graalvm-svm-java17-linux-gluon-22.0.0.3-Final

> mvn -v
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: /opt/maven
Java version: 17.0.2, vendor: GraalVM Community, runtime: /home/user/Downloads/graalvm-svm-java17-linux-gluon-22.0.0.3-Final
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.13.0-44-generic", arch: "amd64", family: "unix"

Build (Working)

mvn gluonfx:run
mvn gluonfx:build

Build (Broken)

mvn gluonfx:runagent
mvn gluonfx:build

Linker Errors

[Tue Jun 07 19:53:11 CEST 2022][FINE] Start process link...
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x130): undefined reference to `Java_com_sun_pisces_PiscesRenderer_setTextureImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x188): undefined reference to `Java_com_sun_pisces_PiscesRenderer_drawImageImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x570): undefined reference to `Java_com_sun_pisces_PiscesRenderer_fillRectImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x728): undefined reference to `Java_com_sun_pisces_PiscesRenderer_setLinearGradientImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x738): undefined reference to `Java_com_sun_pisces_PiscesRenderer_initialize'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x8d0): undefined reference to `Java_com_sun_pisces_PiscesRenderer_setLCDGammaCorrectionImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0x9e8): undefined reference to `Java_com_sun_pisces_AbstractSurface_disposeNative'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0xb08): undefined reference to `Java_com_sun_pisces_PiscesRenderer_setCompositeRuleImpl'
[INFO] ------------------------------------------------------------------------
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0xb28): undefined reference to `Java_com_sun_pisces_JavaSurface_initialize'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0xb98): undefined reference to `Java_com_sun_pisces_AbstractSurface_getRGBImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0xbd0): undefined reference to `Java_com_sun_pisces_PiscesRenderer_clearRectImpl'
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0xc08): undefined reference to `Java_com_sun_pisces_PiscesRenderer_setRadialGradientImpl'
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[Tue Jun 07 19:53:11 CEST 2022][INFO] [SUB] /usr/bin/ld: /home/user/gluon/hello-gluon-ci/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1654624281068/com.gluonhq.hello.hellogluonapp.o:(.data+0xd18): undefined reference to `Java_com_sun_pisces_PiscesRenderer_fillAlphaMaskImpl'

"Fix"

rm src/main/resources/META-INF/native-image/jni-config.json
rm src/main/resources/META-INF/native-image/reflect-config.json
mvn clean gluonfx:build