GNU bug report logs - #41177
Fontconfig issues in Java applications that use fonts

Previous Next

Package: guix;

Reported by: Jonathan Frederickson <jonathan <at> terracrypt.net>

Date: Sun, 10 May 2020 15:56:01 UTC

Severity: normal

Done: Leo Prikler <leo.prikler <at> student.tugraz.at>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41177 in the body.
You can then email your comments to 41177 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#41177; Package guix. (Sun, 10 May 2020 15:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonathan Frederickson <jonathan <at> terracrypt.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 10 May 2020 15:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonathan Frederickson <jonathan <at> terracrypt.net>
To: bug-guix <bug-guix <at> gnu.org>
Subject: Fontconfig issues in Java applications that use fonts
Date: Sun, 10 May 2020 11:55:37 -0400
[Message part 1 (text/plain, inline)]
I realized I forgot to submit a bug report for this after I posted on 
help-guix a while back, and looks like it's still an issue, so... I get 
a null pointer exception when attempting to run any Java application 
that uses fonts. I've attached an example of the error output I get, 
and you can find more info in this thread:

https://lists.gnu.org/archive/html/help-guix/2019-11/msg00122.html

[javanpe.txt (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#41177; Package guix. (Sun, 03 Jan 2021 20:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 41177 <at> debbugs.gnu.org (full text, mbox):

From: Fabien SK <fabsk <at> free.fr>
To: 41177 <at> debbugs.gnu.org
Subject: Fontconfig issues in Java applications that use fonts
Date: Sun, 3 Jan 2021 15:48:17 +0100
I faced the issue when running josm (downloaded from 
josm.openstreetmap.de, not the guix package). Using "strace" showed me 
that it failed because it cannot load "libfontconfig.so" (it tries in 
several directories). If I add the directory of libfontconfig.so to 
LD_LIBRARY_PATH, then it starts.
I have limited knowledge about how shared libraries are found. I tried 
to understand how "geany" manages to load libfontconfig.so. It looks 
like it depends on libgeany, libgtk3 and libpango which depend on 
libfontconfig. When I do a "readelf -a" on these libraries, I can see in 
their "RUNPATH" the path of "libfontconfig.so":
0x000000000000001d (RUNPATH)            Bibliothèque 
runpath:[/gnu/store/avjxs6qgyginkiq6qpk9280zakkaj35h-graphite2-1.3.13/lib:/gnu/store/xwl0p4m34bcan0v9vkjkyzwi6znsv4dm-pixman-0.38.4/lib:/gnu/store/y9fdy234r6hqiacd7hgwlmbdsngbp8p1-fontconfig-2.13.1/lib:…

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:

0x000000000000001d (RUNPATH)            Bibliothèque 
runpath:[$ORIGIN:/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib:/gnu/store/w09mqfj1yy32r2fr02nndzs34m4f9ipp-libxext-1.3.4/lib:/gnu/store/4ildmh169dixyn05mlgjz07x4d2hcq2g-libx11-1.6.A/lib:/gnu/store/8m6368gv4z10n6i31ppbr8nxziwmlp3f-libxrender-0.9.10/lib:/gnu/store/cgsk20z1gcw78fdm7bwlb2l49xh7bmzk-libxtst-1.2.3/lib:/gnu/store/b4dk2y4vf98dhxnr0p6f5h4d86vqndkc-libxi-1.7.10/lib:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../..]

I'm quite a beginner in term of Guix (I only played with it in a VM), 
and I hope this information will be useful to somebody. I don't 
understand how the dependencies between executable and libraries are 
supposed to be done in Guix. I can see that sometimes in /gnu/store 
there are symbolic links of shared libraries into other packages. I 
assume that sometimes this RUNPATH is used.





Information forwarded to bug-guix <at> gnu.org:
bug#41177; Package guix. (Wed, 06 Jan 2021 11:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 41177 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Fabien SK <fabsk <at> free.fr>
Cc: 41177 <at> debbugs.gnu.org
Subject: Re: bug#41177: Fontconfig issues in Java applications that use fonts
Date: Wed, 06 Jan 2021 12:05:54 +0100
Hi,

Fabien SK <fabsk <at> free.fr> 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?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#41177; Package guix. (Tue, 02 Feb 2021 09:12:01 GMT) Full text and rfc822 format available.

Message #14 received at 41177 <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Fabien SK <fabsk <at> free.fr>, 41177 <at> debbugs.gnu.org
Subject: Re: bug#41177: Fontconfig issues in Java applications that use fonts
Date: Tue, 2 Feb 2021 10:11:46 +0100
[Message part 1 (text/plain, inline)]
On Wed, 06 Jan 2021 12:05:54 +0100
Ludovic Courtès <ludo <at> gnu.org> wrote:

> Hi,
> 
> Fabien SK <fabsk <at> free.fr> 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
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#41177; Package guix. (Thu, 11 Feb 2021 23:24:02 GMT) Full text and rfc822 format available.

Message #17 received at 41177 <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Fabien SK <fabsk <at> free.fr>, 41177 <at> debbugs.gnu.org
Subject: Re: bug#41177: Fontconfig issues in Java applications that use fonts
Date: Fri, 12 Feb 2021 00:23:09 +0100
[Message part 1 (text/plain, inline)]
On Tue, 2 Feb 2021 10:11:46 +0100
Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de> wrote:

> On Wed, 06 Jan 2021 12:05:54 +0100
> Ludovic Courtès <ludo <at> gnu.org> wrote:

> > 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.

Patch submitted as:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=46451

Björn
[Message part 2 (application/pgp-signature, inline)]

Reply sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
You have taken responsibility. (Fri, 12 Feb 2021 10:53:02 GMT) Full text and rfc822 format available.

Notification sent to Jonathan Frederickson <jonathan <at> terracrypt.net>:
bug acknowledged by developer. (Fri, 12 Feb 2021 10:53:02 GMT) Full text and rfc822 format available.

Message #22 received at 41177-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
Cc: 46451-done <at> debbugs.gnu.org, 41177-done <at> debbugs.gnu.org
Subject: Re: [PATCH 0/2] OpenJDK: Fix NullPointerException when accessing fonts
Date: Fri, 12 Feb 2021 11:52:50 +0100
Hi Björn

Am Freitag, den 12.02.2021, 00:14 +0100 schrieb Björn Höfling:
> These two patches fix a NullPointerException in the OpenJDK packages.
> 
> The patches apply only to OpenJDK9 and OpenJDK11, but with
> inheritence
> all OpenJDKx with x\in[9..14] are covered.
> 
> Here is the bug report:
> 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41177
> 
> In order to test it you can use the following Main.java:
> 
> ~~~~~~
> import java.awt.*;
> 
> public class Main {
> 
>     public static void main(String[] args)
>     {
>         String fonts[] =
>             GraphicsEnvironment.getLocalGraphicsEnvironment().getAvai
> lableFontFamilyNames();
> 
>         for ( int i = 0; i < fonts.length; i++ )
> 	    {
> 		System.out.println(fonts[i]);
> 	    }
>     }
> }
> 
> ~~~~~~~~
> Compile: javac Main.java
> Run: java -cp . Main
> 
> It should print a list of the available fonts.
Indeed, that it does.  At least for 9 and 11, which I've invoked
directly from their store paths.

I've pushed your patches with small changes to the commit messages and
followed up with an indentation fix.

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#41177; Package guix. (Fri, 12 Feb 2021 20:00:02 GMT) Full text and rfc822 format available.

Message #25 received at 41177-done <at> debbugs.gnu.org (full text, mbox):

From: Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 46451-done <at> debbugs.gnu.org, 41177-done <at> debbugs.gnu.org
Subject: Re: [PATCH 0/2] OpenJDK: Fix NullPointerException when accessing fonts
Date: Fri, 12 Feb 2021 20:59:39 +0100
[Message part 1 (text/plain, inline)]
On Fri, 12 Feb 2021 11:52:50 +0100
Leo Prikler <leo.prikler <at> student.tugraz.at> wrote:

> I've pushed your patches with small changes to the commit messages and
> followed up with an indentation fix.

Thanks! 

Björn

[Message part 2 (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 13 Mar 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 36 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.