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

GraalVM/Mandrel 20.3 images: libfreetype.so.6: cannot open shared object file: No such file or directory #112

Closed
rsvoboda opened this issue Nov 20, 2020 · 4 comments · Fixed by #113

Comments

@rsvoboda
Copy link
Member

I have hit libfreetype.so.6: cannot open shared object file: No such file or directory error when using GraalVM/Mandrel 20.3 images to compile project which uses graphics.

When running 20.3 GraalVM CE installed on my macOS the is no error in compilation.
(There is of course problem of no awt in java.library.path when hitting http://localhost:8080/ping which should be solved in Mandrel as mentioned in oracle/graal#2842)

CC @Karm / @cescoffier / @zakkak

Original exception that caused the problem: java.lang.UnsatisfiedLinkError: /opt/mandrel/lib/libfontmanager.so:
  libfreetype.so.6: cannot open shared object file: No such file or directory

Original exception that caused the problem: java.lang.UnsatisfiedLinkError: /opt/graalvm/lib/libfontmanager.so:
  libfreetype.so.6: cannot open shared object file: No such file or directory

Reproducer:

  • Download https://github.com/rsvoboda/rsvoboda-playground/tree/master/jfreesvg/jfreesvg-quarkus
  • run mvn clean package -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=4g -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:20.3.0.0.Beta1-java11
    or
  • run mvn clean package -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=4g -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:20.3.0-java11

More detailed stacktrace:

Original exception that caused the problem: java.lang.UnsatisfiedLinkError: /opt/mandrel/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2648)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
	at java.base/java.lang.System.loadLibrary(System.java:1873)
	at java.desktop/sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:57)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
	at java.desktop/sun.font.SunLayoutEngine.<clinit>(SunLayoutEngine.java:109)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1042)
	at jdk.unsupported/sun.misc.Unsafe.ensureClassInitialized(Unsafe.java:698)
	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.ensureClassInitialized(ConfigurableClassInitialization.java:174)
	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:607)
	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:127)
	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.shouldInitializeAtRuntime(ConfigurableClassInitialization.java:155)
	at com.oracle.svm.hosted.SVMHost.isInitialized(SVMHost.java:291)
	at com.oracle.graal.pointsto.meta.AnalysisType.isInitialized(AnalysisType.java:786)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.maybeEagerlyInitialize(BytecodeParser.java:4384)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1624)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1617)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5360)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3399)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3206)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1092)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:986)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:70)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:223)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:357)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:313)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:302)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
	at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:434)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:547)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
@Karm
Copy link
Member

Karm commented Nov 20, 2020

/me taking it

@Karm
Copy link
Member

Karm commented Nov 20, 2020

I have a fix locally:

[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jfreesvg-quarkus ---
[INFO] Building jar: /home/karm/workspaceRH/rsvoboda-playground/jfreesvg/jfreesvg-quarkus/target/jfreesvg-quarkus-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- quarkus-maven-plugin:1.10.0.Final:build (default) @ jfreesvg-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.1.1.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /home/karm/workspaceRH/rsvoboda-playground/jfreesvg/jfreesvg-quarkus/target/jfreesvg-quarkus-1.0-SNAPSHOT-native-image-source-jar/jfreesvg-quarkus-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /home/karm/workspaceRH/rsvoboda-playground/jfreesvg/jfreesvg-quarkus/target/jfreesvg-quarkus-1.0-SNAPSHOT-native-image-source-jar/jfreesvg-quarkus-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Checking image status karm/ubi-quarkus-mandrel:20.3.0.0.Beta1-java11
Error response from daemon: manifest for karm/ubi-quarkus-mandrel:20.3.0.0.Beta1-java11 not found: manifest unknown: manifest unknown
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.3.0.0.Beta1 (Mandrel Distribution) (Java Version 11.0.9+11)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /home/karm/workspaceRH/rsvoboda-playground/jfreesvg/jfreesvg-quarkus/target/jfreesvg-quarkus-1.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --user 1000:1000 --rm karm/ubi-quarkus-mandrel:20.3.0.0.Beta1-java11 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -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=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar jfreesvg-quarkus-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -J-Xmx4g -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace jfreesvg-quarkus-1.0-SNAPSHOT-runner
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]    classlist:   1,502.69 ms,  1.19 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]        (cap):     483.13 ms,  1.19 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]        setup:   1,815.41 ms,  1.19 GB
09:25:56,319 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]     (clinit):     500.45 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]   (typeflow):   9,825.37 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]    (objects):  11,662.29 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]   (features):     507.47 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]     analysis:  23,250.48 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]     universe:   1,243.29 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]      (parse):   3,132.31 ms,  1.89 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]     (inline):   7,588.94 ms,  2.83 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]    (compile):  16,142.24 ms,  2.93 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]      compile:  28,477.03 ms,  2.93 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]        image:   4,115.87 ms,  2.93 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]        write:     472.56 ms,  2.93 GB
[jfreesvg-quarkus-1.0-SNAPSHOT-runner:58]      [total]:  61,062.38 ms,  2.93 GB
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 67209ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:13 min
[INFO] Finished at: 2020-11-20T10:26:44+01:00

Gonna put it in in a PR for the quarkus-images.

Lemme try older versions too.

And perhaps we should add the dependency to documentation....

@rsvoboda
Copy link
Member Author

+1 for docs update

@zakkak
Copy link
Collaborator

zakkak commented Nov 26, 2020

@rsvoboda FYI 20.3.0.0.Beta2 should work see:

packages:
install:
- fontconfig

matthyx pushed a commit to matthyx/quarkus-images that referenced this issue Sep 20, 2021
…-haproxy-config-dot-template

Set log-send-hostname in haproxy-config.template
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

Successfully merging a pull request may close this issue.

3 participants