all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>
To: Jonathan Frederickson <jonathan@terracrypt.net>
Cc: help-guix@gnu.org
Subject: Re: Java fontconfig issues
Date: Fri, 29 Nov 2019 00:50:16 +0100	[thread overview]
Message-ID: <20191129005016.3a034b2e@alma-ubu> (raw)
In-Reply-To: <20191116115724.68eb6f31@terracrypt.net>

[-- Attachment #1: Type: text/plain, Size: 3861 bytes --]

Hi Jonathan,

On Sat, 16 Nov 2019 11:57:24 -0500
Jonathan Frederickson <jonathan@terracrypt.net> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2019-11-29  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16 16:57 Java fontconfig issues Jonathan Frederickson
2019-11-28 23:50 ` Björn Höfling [this message]
2019-11-30 23:53   ` Björn Höfling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191129005016.3a034b2e@alma-ubu \
    --to=bjoern.hoefling@bjoernhoefling.de \
    --cc=help-guix@gnu.org \
    --cc=jonathan@terracrypt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.