oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.2k stars 1.62k forks source link

Undefined reference to `Java_sun_font_SunLayoutEngine_disposeFace' #8388

Open JiriOndrusek opened 6 months ago

JiriOndrusek commented 6 months ago

Describe the issue

I'm trying to create a native extension for camel quarkus for jt400. Extension is based on Camel jt400 component and brings JTOpen (v20.0.6).

I'm getting:

Fatal error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1
...
undefined reference to `Java_sun_font_SunLayoutEngine_disposeFace'

Steps to reproduce the issue

  1. clone git@github.com:JiriOndrusek/camel-quarkus.git
  2. checkout branch linkage-error-SunLayoutEngine_disposeFace ( git checkout linkage-error-SunLayoutEngine_disposeFace)
  3. build the project mvn clean install -Dquickly
  4. run jt400 test mvn clean verify -Pnative -f integration-tests-jvm/jt400

Describe GraalVM and your environment:

More details Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.

[INFO] --- quarkus:3.8.0.CR1:build (quarkus-build) @ camel-quarkus-integration-test-jt400 ---
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /home/jondruse/git/community/camel-quarkus/integration-tests-jvm/jt400/target/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-native-image-source-jar/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /home/jondruse/git/community/camel-quarkus/integration-tests-jvm/jt400/target/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-native-image-source-jar/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GRAALVM 22.3.2 JDK 17.0.7+8-LTS-jvmci-22.3-b15
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dlogging.initial-configurator.min-level=500 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 --features=io.quarkus.runner.Feature,io.quarkus.runtime.graal.DisableLoggingFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+CollectImageBuildStatistics -H:ImageBuildStatisticsFile=camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner-timing-stats.json -H:BuildOutputJSONFile=camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner-build-output-stats.json --report-unsupported-elements-at-runtime --initialize-at-run-time=sun.awt.dnd.SunDropTargetContextPeer\$EventDispatcher -H:+AllowFoldMethods -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+ReportExceptionStackTraces -H:-AddAllCharsets --enable-url-protocols=http -H:NativeLinkerOption=-no-pie --enable-monitoring=heapdump -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner -jar camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.jar
========================================================================================================================
GraalVM Native Image: Generating 'camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                    (7.3s @ 0.43GB)
 Version info: 'GraalVM 22.3.2 Java 17 EE'
 Java version info: '17.0.7+8-LTS-jvmci-22.3-b15'
 C compiler: gcc (redhat, x86_64, 12.2.1)
 Garbage collector: Serial GC
 3 user-specific feature(s)
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - org.eclipse.angus.activation.nativeimage.AngusActivationFeature
[2/7] Performing analysis...  [******]                                                                  (59.6s @ 3.03GB)
  16,833 (85.31%) of 19,731 classes reachable
  25,373 (63.08%) of 40,221 fields reachable
  87,929 (56.55%) of 155,502 methods reachable
     727 classes,   127 fields, and 5,585 methods registered for reflection
      64 classes,    68 fields, and    58 methods registered for JNI access
       6 native libraries: dl, m, pthread, rt, stdc++, z
[3/7] Building universe...                                                                               (5.4s @ 2.39GB)
[4/7] Parsing methods...      [**]                                                                       (4.9s @ 3.74GB)
[5/7] Inlining methods...     [***]                                                                      (2.1s @ 1.82GB)
[6/7] Compiling methods...    [**********]                                                             (109.5s @ 4.65GB)
[7/7] Creating image...
                                                                                  (0.0s @ 3.20GB)
Fatal error: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -Wl,--gc-sections -Wl,--dynamic-list -Wl,/tmp/SVM-3801940630018007160/exported_symbols.list -Wl,--exclude-libs,ALL -Wl,-x -o /home/jondruse/git/community/camel-quarkus/integration-tests-jvm/jt400/target/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-native-image-source-jar/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.o /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libnet.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libextnet.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libnio.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libjava.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libprefs.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libawt_headless.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libawt.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libfdlibm.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libzip.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64/libjvm.a -v -L/tmp/SVM-3801940630018007160 -L/home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc -L/home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64 -lstdc++ -lm -lz -lpthread -ldl -lrt -no-pie

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-12.2.1-20221121/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20221121 (Red Hat 12.2.1-4) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/12/:/usr/libexec/gcc/x86_64-redhat-linux/12/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/12/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/12/:/usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/12/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-o' '/home/jondruse/git/community/camel-quarkus/integration-tests-jvm/jt400/target/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-native-image-source-jar/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner' '-v' '-L/tmp/SVM-3801940630018007160' '-L/home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc' '-L/home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64' '-no-pie' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/jondruse/git/community/camel-quarkus/integration-tests-jvm/jt400/target/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-native-image-source-jar/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.'
 /usr/libexec/gcc/x86_64-redhat-linux/12/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/12/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper -plugin-opt=-fresolution=/tmp/cc2ufZNm.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 --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/jondruse/git/community/camel-quarkus/integration-tests-jvm/jt400/target/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-native-image-source-jar/camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner -z noexecstack /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/12/crtbegin.o -L/tmp/SVM-3801940630018007160 -L/home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc -L/home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-redhat-linux/12 -L/usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/12/../../.. --gc-sections --dynamic-list /tmp/SVM-3801940630018007160/exported_symbols.list --exclude-libs ALL -x camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.o /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libnet.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libextnet.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libnio.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libjava.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libprefs.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libawt_headless.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libawt.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libfdlibm.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/static/linux-amd64/glibc/libzip.a /home/jondruse/dev/graal/graalvm-ee-java17-22.3.2/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -lm -lz -lpthread -ldl -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-redhat-linux/12/crtend.o /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crtn.o
/usr/bin/ld: camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner.o:(.data+0x3d8): undefined reference to `Java_sun_font_SunLayoutEngine_disposeFace'
collect2: error: ld returned 1 exit status
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:203)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:117)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:718)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
------------------------------------------------------------------------------------------------------------------------
                        6.2s (3.0% of total time) in 67 GCs | Peak RSS: 7.17GB | CPU load: 8.42
========================================================================================================================
Failed generating 'camel-quarkus-integration-test-jt400-3.8.0-SNAPSHOT-runner' after 3m 23s.
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
fniephaus commented 6 months ago

Hi @JiriOndrusek, thanks for the ticket. Could you try running this on a newer GraalVM? 22.3.2 is a bit old, maybe we fixed this in the meantime. The latest GraalVM for JDK 17 is 17.0.10.

aelmassa commented 6 months ago

Hi GraalVM EE 22.3.2 is not supported. Could you please try with the latest version? Did you test with GraalVM FOR JDK 21? Thank you

aelmassa commented 6 months ago

I tested this in Darwin M1 with the latest version of GraalVM for JDK 17 (17.0.10); The issue is not reproducible.

Could you confirm that you still have the same issue in the latest version?

https://www.graalvm.org/downloads/#

JiriOndrusek commented 6 months ago

I tested this in Darwin M1 with the latest version of GraalVM for JDK 17 (17.0.10); The issue is not reproducible.

Could you confirm that you still have the same issue in the latest version?

https://www.graalvm.org/downloads/#

Thank you for your verification, I'll check whether my local results are the same.