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

Temurin 21 JDK does not link to major version of libfreetype or is not statically linked #3624

Closed
nudgegoonies opened this issue Jan 29, 2024 · 13 comments · Fixed by adoptium/installer#812
Assignees

Comments

@nudgegoonies
Copy link

What are you trying to do?
Do something that uses the font manager.

Expected behaviour:
It should work like with Temurin 17 JDK.

Observed behaviour:
Error in java when using Temurin 21 JDK:

[...]
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
[...]
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /usr/lib/jvm/temurin-21-jdk-amd64/lib/libfontmanager.so: libfreetype.so: cannot open shared object file: No such file or directory
[...]

Any other comments:
Can be verified by using ldd libfontmanager.so | grep freetype:
temurin 17:
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fbccc335000)
in comparison to temurin 21:
libfreetype.so => not found

debian package is temurin-21-jdk in version 21.0.2.0.0+13
operating system is Debian 12

@sxa
Copy link
Member

sxa commented Jan 29, 2024

Interesting. Thanks for the report! We did change the build platform for Linux/x64 for JDK21, but I've replicated this on Linux/aarch64 which hasn't changed so it's not related to that.

Noting that most other openjdk providers seem to ship their own freetype library. Temurin does not

#3557 indicates we changed the behaviour for JDK21+ as a result of discussions in #3504.

FYI @andrew-m-leonard - we should probably call this out in https://adoptium.net/blog/2024/01/eclipse-temurin-8u402-11022-1710-and-2102-available but it seems we may have a change in behaviour here which was not expected.

@sxa
Copy link
Member

sxa commented Jan 29, 2024

Noting that installing libfreetype-dev alongside libfreetype6 should resolve this, as it includes the desired libfreetype.so symlink under /usr/lib/<arch_triple>

@andrew-m-leonard
Copy link
Contributor

not sure I understand the "scenario" ?
libfontmanager.so and libfreetype.so are within the same directory

Is this an Installer issue maybe?

@sxa
Copy link
Member

sxa commented Jan 29, 2024

not sure I understand the "scenario" ? libfontmanager.so and libfreetype.so are within the same directory

Is this an Installer issue maybe?

Quite likely - it looks like it's present in the tarball (which I hadn't checked earlier but not the installed .deb ...

@sxa
Copy link
Member

sxa commented Feb 8, 2024

Assigning George as he agreed to look at this in the PMC potentially as part of his investigations of adoptium/installer#801 in case they can both be tested together

@jiekang jiekang moved this from Done to In Progress in 2024 1Q Adoptium Plan Feb 21, 2024
@sxa sxa assigned steelhead31 and unassigned gdams Feb 29, 2024
@sxa
Copy link
Member

sxa commented Feb 29, 2024

I believe @steelhead31 has resolved this now, so I'll leave him to add some closing comments :-)

@steelhead31
Copy link
Contributor

The initial bug was fixed in adoptium/installer#812 , which then subsequently required republished of the JDK21.0.2+13 release packages, which was complete via PR adoptium/installer#824 , in addition s390x support was added adoptium/installer#827 and a bug identified and fixed in the JRE 21 RPM packages which was also fixed adoptium/installer#831. All the new installer packages have been published to the jfrog artifactory, and can be identified with the suffixed spec version of -2 ( and -3 for the ppc64le JRE fix ).

@github-project-automation github-project-automation bot moved this from In Progress to Done in 2024 1Q Adoptium Plan Mar 4, 2024
@nudgegoonies
Copy link
Author

Thank you!

@DRoppelt
Copy link

DRoppelt commented Apr 8, 2024

Debian images (e.g. tag eclipse-temurin:21.0.2_13-jdk, https://hub.docker.com/layers/library/eclipse-temurin/21.0.2_13-jdk/images/sha256-723e15b2ddb23812fcb49eb688717f926545504e69a24b8f3b2135777de1c3b9?context=explore) appear to have been rebuilt 11days ago and we found some builds on our CI infra to fail with

java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration at 
java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1263) at 
java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:221) at 
java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:105) at 
java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:696) at 
java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:352) at 
java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:309) at 
java.base/java.security.AccessController.doPrivileged(AccessController.java:319) at 
java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:309) at 
java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35) at 
java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:55) at 
java.desktop/sun.font.PlatformFontInfo.createFontManager(PlatformFontInfo.java:37) at 
java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:51) at 
java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:242) at 
java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:260) at 
java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:862) 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:1260) at 
org.jfree.chart.JFreeChart.draw(JFreeChart.java:1150) at 
org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1343) at 
org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1324) at 
org.jfree.chart.ChartUtils.writeChartAsPNG(ChartUtils.java:144) at 
org.jfree.chart.ChartUtils.writeChartAsPNG(ChartUtils.java:98) at 

Is this directly related? If so, shall I create a ticket in the containers project?

@sxa
Copy link
Member

sxa commented Apr 8, 2024

I think that's different enough to warrant creation of another issue. What are you running when you get that error? It would be good to have a recreate since just running the image with jshell doesn't seem to show that exception. If you can determine if it is reproducible outside the container image that would also be useful to know.

@andrew-m-leonard
Copy link
Contributor

Debian images (e.g. tag eclipse-temurin:21.0.2_13-jdk, https://hub.docker.com/layers/library/eclipse-temurin/21.0.2_13-jdk/images/sha256-723e15b2ddb23812fcb49eb688717f926545504e69a24b8f3b2135777de1c3b9?context=explore) appear to have been rebuilt 11days ago and we found some builds on our CI infra to fail with

java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration at 
java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1263) at 
java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:221) at 
java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:105) at 
java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:696) at 
java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:352) at 
java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:309) at 
java.base/java.security.AccessController.doPrivileged(AccessController.java:319) at 
java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:309) at 
java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35) at 
java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:55) at 
java.desktop/sun.font.PlatformFontInfo.createFontManager(PlatformFontInfo.java:37) at 
java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:51) at 
java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:242) at 
java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:260) at 
java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:862) 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:1260) at 
org.jfree.chart.JFreeChart.draw(JFreeChart.java:1150) at 
org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1343) at 
org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1324) at 
org.jfree.chart.ChartUtils.writeChartAsPNG(ChartUtils.java:144) at 
org.jfree.chart.ChartUtils.writeChartAsPNG(ChartUtils.java:98) at 

Is this directly related? If so, shall I create a ticket in the containers project?

I am wondering if the container image needs "fontconfig" installing ?

@DRoppelt
Copy link

DRoppelt commented Apr 8, 2024

@sxa ok will create an issue later and see if I can create a minimal demo to reproduce it

@andrew-m-leonard fontconfig should already be installed but I'll try to verify if that is a "should" or actually present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants