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

Adds freetype library as per issue 112 #113

Merged
merged 1 commit into from
Nov 26, 2020
Merged

Conversation

Karm
Copy link
Member

@Karm Karm commented Nov 20, 2020

Hello,

Closes #112

I tried the reproducer from #112 with an altered image:

FROM quay.io/quarkus/ubi-quarkus-mandrel:20.3.0.0.Beta1-java11
USER root
RUN mkdir /var/cache/yum/metadata -p && \
    microdnf update libdnf
RUN microdnf install freetype.x86_64

And it works just fine:

[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
[INFO] ------------------------------------------------------------------------

I checked older images and they all have the same problem. I added the dependency for them too.

Thoughts? Ideas? @zakkak @jerboaa

@zakkak
Copy link
Collaborator

zakkak commented Nov 20, 2020

@Karm did you try with graalvm, i.e., ubi-quarkus-native-image, images as well?

@jerboaa
Copy link
Contributor

jerboaa commented Nov 20, 2020

@Karm OpenJDK 11 RPMs require fontconfig(x86-64) which transitively drag in freetype. I wonder if we should install fontconfig instead.

@Karm
Copy link
Member Author

Karm commented Nov 20, 2020

While the app builds, it still doesn't work: (which is expected I guess oracle/graal#2842)

Caused by: java.lang.UnsupportedOperationException: Not implemented yet for GraalVM native images
	at sun.java2d.cmm.lcms.LCMS.initLCMS(LCMS.java:48)
	at sun.java2d.cmm.lcms.LCMS.getModule(LCMS.java:214)
	at sun.java2d.cmm.lcms.LcmsServiceProvider.getModule(LcmsServiceProvider.java:34)
	at sun.java2d.cmm.CMMServiceProvider.getColorManagementModule(CMMServiceProvider.java:31)
	at sun.java2d.cmm.CMSManager.getModule(CMSManager.java:68)
	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:790)
	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:1026)
	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:991)
	at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:940)
	at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:936)
	at java.security.AccessController.doPrivileged(AccessController.java:84)
	at java.awt.color.ICC_Profile.getStandardProfile(ICC_Profile.java:935)
	at java.awt.color.ICC_Profile.getDeferredInstance(ICC_Profile.java:1067)
	at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:854)
	at java.awt.color.ColorSpace.getInstance(ColorSpace.java:298)
	at java.awt.image.DirectColorModel.<init>(DirectColorModel.java:182)
	at java.awt.image.BufferedImage.<init>(BufferedImage.java:318)
	at org.jfree.graphics2d.svg.SVGGraphics2D.getFontMetrics(SVGGraphics2D.java:1656)
	at java.awt.Graphics.getFontMetrics(Graphics.java:257)
	at org.jfree.chart.text.G2TextMeasurer.getStringWidth(G2TextMeasurer.java:63)
	at org.jfree.chart.text.TextUtils.nextLineBreak(TextUtils.java:227)
	at org.jfree.chart.text.TextUtils.createTextBlock(TextUtils.java:168)
	at org.jfree.chart.title.TextTitle.arrangeRR(TextTitle.java:628)
	at org.jfree.chart.title.TextTitle.arrange(TextTitle.java:496)
	at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1370)
	at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1260)
	at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1160)
	at cz.rsvoboda.PingResource.ping(PingResource.java:48)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
	at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:643)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:507)
	at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:457)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:459)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:419)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:393)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:68)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:492)
	... 19 more

And it doesn't load the freetype at runtime lsof | grep freetype | grep 1894404 nor it's linked dynamically:

target/jfreesvg-quarkus-1.0-SNAPSHOT-runner
	linux-vdso.so.1 (0x00007ffd89700000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f0bbc55c000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f0bbc1da000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0bbbfba000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f0bbbdb6000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f0bbbb9f000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f0bbb996000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f0bbb5d4000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f0bbc8f1000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0bbb3bc000)

@zakkak I did just now and at least quay.io/quarkus/ubi-quarkus-native-image:20.3-java11 is no better:

Error: Class initialization of sun.font.SunLayoutEngine failed. Use the option --initialize-at-run-time=sun.font.SunLayoutEngine to explicitly request delayed initialization of this class.
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

@jerboaa Sounds reasonable to me. Lemme amend the PR....

@zakkak
Copy link
Collaborator

zakkak commented Nov 20, 2020

@zakkak I did just now and at least quay.io/quarkus/ubi-quarkus-native-image:20.3-java11 is no better:

Error: Class initialization of sun.font.SunLayoutEngine failed. Use the option --initialize-at-run-time=sun.font.SunLayoutEngine to explicitly request delayed initialization of this class.
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

Hmmm, correct! It's expected to fail with 20.3 due to oracle/graal#2842.

What about freetype though? Don't we need to install it in ubi-quarkus-native-image as well?

@rsvoboda
Copy link
Member

ubi-quarkus-native-image should be updated too, it has the same problem as mentioned in #112

@Karm
Copy link
Member Author

Karm commented Nov 20, 2020

@jerboaa @zakkak Amended to fontconfig and I can confirm it works too. Amended to include these images:

  • graalvm/20.2.0-java11/module.yaml
  • graalvm/20.2.0-java8/module.yaml
  • graalvm/20.3.0-java11/module.yaml
  • mandrel/20.1.0.3.Final-java11/module.yaml
  • mandrel/20.2.0.0.Final-java11/module.yaml
  • mandrel/20.3.0.0.Beta1-java11/module.yaml

Copy link
Contributor

@jerboaa jerboaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Collaborator

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Karm

@rsvoboda
Copy link
Member

@cescoffier can you merge these changes?

@cescoffier cescoffier merged commit 454cee4 into quarkusio:master Nov 26, 2020
matthyx pushed a commit to matthyx/quarkus-images that referenced this pull request Sep 20, 2021
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 this pull request may close these issues.

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