Subject: Re: bug#41177: Fontconfig issues in Java applications that use fonts

From: Björn Höfling <[email-masked]>
Date: Tue, 2 Feb 2021 10:11:46 +0100

On Wed, 06 Jan 2021 12:05:54 +0100
Ludovic Courtès <[email-masked]> wrote:

> Hi,
> 
> Fabien SK <[email-masked]> skribis:
> 
> > Regarding Java, I think (but I'm not sure) that it's loaded by
> > "libawt_xawt.so". In fontpath.c [1], there is a dlopen of
> > libfontconfig. But if I do a "ldd" on the shared library itself, it
> > looks like it does not depend on libfontconfig.so.
> > [1]
> > https://github.com/openjdk/jdk16/blob/37043b05576c8b81b43ac41a8f06de0d0bbb3f5b/src/java.desktop/unix/native/common/awt/fontpath.c#L566
> > Also libfontconfig is not on its RUNPATH:  
> 
> Indeed, all the ‘openjdk’ packages have fontconfig has an input, but
> ‘guix size openjdk | grep fontconfig’ shows it’s not there, meaning
> that nothing actually linked against fontconfig.
> 
> Perhaps we should patch this ‘fontpath.c’, with ‘substitute*’, so that
> it refers to libfontconfig.so by its absolute file name?

We do that for icedtea (i.e. OpenJDK until version 8), but not for
OpenJDK. I applied the same trick for OpenJDK 9 and will no longer get
the NullPointerException.

Let me clean it up a bit and apply it to all later OpenJDKs as well
(might be already done through inheritence, but let me check), then I
will send out a patch.

Björn