help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java fontconfig issues


From: Björn Höfling
Subject: Re: Java fontconfig issues
Date: Fri, 29 Nov 2019 00:50:16 +0100

Hi Jonathan,

On Sat, 16 Nov 2019 11:57:24 -0500
Jonathan Frederickson <address@hidden> wrote:

> I've been trying to run PCGen
> (https://github.com/PCGen/pcgen/releases) on my laptop running Guix
> System, so far without success. I know that ideally all software would
> be installed through Guix itself, but this thing is a Java app with
> several dependencies that aren't in Guix yet and... honestly, right at
> this moment, I'd be fine with running the jar directly for now.
> 
> However, when attempting to run this Jar with openjdk installed, I get
> a null pointer exception related to some font configuration code. This
> seems related to an issue on the AdoptOpenJDK repos[0], which was
> solved in that case by installing the fontconfig package (on a Debian
> install in their case). However, installing fontconfig into my profile
> in Guix hasn't done the trick. There's a workaround mentioned
> involving creating a fontconfig.properties file in JAVA_HOME, but
> setting that as an environment variable didn't seem to do the trick
> either.
> 
> While the specific application I'm focusing on is PCGen, this seems to
> affect graphical Java applications in general; I tested with a
> generic JAR build of Jitsi and ran into the same issue.
> 
> Can anyone familiar with Java provide some assistance in tracking down
> this problem?
> 
> https://github.com/AdoptOpenJDK/openjdk-build/issues/693

I found that error too in ProjectLibre and even in Tomcat, which is not
"graphical", but just uses fonts.

Here is a very small program to trigger the error:

import java.awt.*;

public class Main {

    public static void main(String[] args)
    {
        String fonts[] =
            
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

        for ( int i = 0; i < fonts.length; i++ )
            {
                System.out.println(fonts[i]);
            }
    }
}

(I think I have that snipped from the AdoptOpenJDK-Bug, not 100% sure).

If I enter a Guix-Container with OpenJDK 12 or 11 (not tried 10,9),
compile and run it, it will fail (you need to compile new for each
version because of different target versions) with the
NullPointerException. As you mentioned, even adding fontconfig to that
environment does not help.

It works with JDK 8 though, provided through the icedtea@3 package. If
your Java program still works with Java 8, that might be a workaround
for you.

Here are the specific environments I tried:

guix environment -C  --share=/tmp/.X11-unix --ad-hoc coreutils less grep 
findutils ant which icedtea@3:jdk
guix environment -C  --share=/tmp/.X11-unix --ad-hoc coreutils less grep 
findutils ant which openjdk@12:jdk
guix environment -C  --share=/tmp/.X11-unix --ad-hoc coreutils less grep 
findutils ant which openjdk@11:jdk


In each, I called these commands:

$ javac Main.java
$ java -cp . Main

I see that fontconfig is a reference of both icedtea and openjdk:

$ guix gc --references 
/gnu/store/05flqf4bqwwj4zwl2vqiqg0dlb1alzm8-icedtea-3.7.0-jdk | grep font
/gnu/store/rkq6ipys8hf5hw66jkzzw4nfr6ncq96a-fontconfig-2.13.1

$ guix gc --references 
/gnu/store/wsl1wy131kgnvlyaiv4hz6a6ysavkcr8-openjdk-12.33-jdk/ | grep font
/gnu/store/rkq6ipys8hf5hw66jkzzw4nfr6ncq96a-fontconfig-2.13.1


It looks like having the reference is not enough.

Going from the AdoptOpenJDK bug to

https://github.com/docker-library/openjdk/issues/46

leads to a bug report at debian's site:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793210

They talked about different configure flags in there icedtea package
and they have a fix for their JDK package.

Here my time is out for now and my next free time slot might come only
in two weeks. So, if someone else wants to look into this any earlier,
I don't mind :-)

Björn



Attachment: pgpu1NuqgJVvb.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]