[-- Attachment #1: Type: text/plain, Size: 396 bytes --] 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 [-- Attachment #2: javanpe.txt --] [-- Type: text/plain, Size: 2922 bytes --] jfred@lambdacrypt ~/Downloads/pcgen$ java -jar pcgen.jar 11:52:16.300 INFO main Main:138 Starting PCGen v6.08.00 RC6 11:52:16.390 INFO main LanguageBundle:134 Initialising language bundle with locale en_US. 11:52:16.631 SEVERE main Main:484 Uncaught error - ignoring java.lang.InternalError: java.lang.reflect.InvocationTargetException at java.desktop/sun.font.FontManagerFactory$1.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.desktop/sun.font.FontManagerFactory.getInstance(Unknown Source) at java.desktop/sun.font.FontUtilities.getFontConfigFUIR(Unknown Source) at java.desktop/javax.swing.plaf.nimbus.NimbusDefaults.<init>(Unknown Source) at java.desktop/javax.swing.plaf.nimbus.NimbusLookAndFeel.<init>(Unknown Source) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source) at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) at java.base/java.lang.Class.newInstance(Unknown Source) at java.desktop/javax.swing.UIManager.setLookAndFeel(Unknown Source) at pcgen.gui2.plaf.LookAndFeelManager.setLookAndFeel(LookAndFeelManager.java:231) at pcgen.gui2.plaf.LookAndFeelManager.initLookAndFeel(LookAndFeelManager.java:151) at pcgen.system.Main.configureUI(Main.java:273) at pcgen.system.Main.startupWithGUI(Main.java:228) at pcgen.system.Main.main(Main.java:157) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) ... 19 more Caused by: java.lang.NullPointerException at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source) at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(Unknown Source) at java.desktop/sun.awt.FontConfiguration.init(Unknown Source) at java.desktop/sun.awt.X11FontManager.createFontConfiguration(Unknown Source) at java.desktop/sun.font.SunFontManager$2.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.desktop/sun.font.SunFontManager.<init>(Unknown Source) at java.desktop/sun.awt.FcFontManager.<init>(Unknown Source) at java.desktop/sun.awt.X11FontManager.<init>(Unknown Source) ... 24 more
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.
Hi,
Fabien SK <fabsk@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’.
[-- Attachment #1: Type: text/plain, Size: 1289 bytes --] On Wed, 06 Jan 2021 12:05:54 +0100 Ludovic Courtès <ludo@gnu.org> wrote: > Hi, > > Fabien SK <fabsk@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 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #1: Type: text/plain, Size: 766 bytes --] On Tue, 2 Feb 2021 10:11:46 +0100 Björn Höfling <bjoern.hoefling@bjoernhoefling.de> wrote: > On Wed, 06 Jan 2021 12:05:54 +0100 > Ludovic Courtès <ludo@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 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 195 bytes --]