Bug 284503 - java/openjdk23 missing libfontconfig.so dependency
Summary: java/openjdk23 missing libfontconfig.so dependency
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-java (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-01 15:20 UTC by Patrick Mackinlay
Modified: 2025-03-01 20:01 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Mackinlay 2025-02-01 15:20:55 UTC
Running swing application with openjdk23 (openjdk23-23.0.1+11.1 on 14.2-RELEASE-p1) fails with:

ld-elf.so.1: /usr/local/openjdk23/lib/libfontmanager.so: Undefined symbol "FcPatternCreate"

There are no such errors with all earlier openjdk versions I have used (openjdk22 works)

ldd /usr/local/openjdk23/lib/libfontmanager.so does not include libfontconfig.so.1
ldd /usr/local/openjdk22/lib/libfontmanager.so does include libfontconfig.so.1
Comment 1 Harald Eilertsen 2025-02-02 11:42:01 UTC
(In reply to Patrick Mackinlay from comment #0)
Thanks for the report, I'll have a look at it.
Comment 2 Harald Eilertsen 2025-02-03 11:30:26 UTC
I found the issue. The openjdk22 port contains a patch for libfontmanager that caused it to depend on fontconfig. The port also contains a patch for the makefile to link with libfontconfig.

As the structure of the makefiles has been changed for OpenJDK 23, that latter patch fell out, while the first patch remained in the build.

I suggest just removing that patch, as the JDK font handling should load fontconfig itself when it is needed, and I could not find any immediate rationale for why that patch was there in the first place.

The alternative is to add back the link to libfontconfig from fontmanager, but if I'd like to know why we need it if we do that.

https://reviews.freebsd.org/D48806
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-03-01 19:59:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3f02459fe6b2806af3a53070c7dc54b455314cc2

commit 3f02459fe6b2806af3a53070c7dc54b455314cc2
Author:     Harald Eilertsen <haraldei@anduin.net>
AuthorDate: 2025-03-01 17:32:52 +0000
Commit:     Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2025-03-01 19:58:38 +0000

    java/openjdk23: Delete patch for fontmanager/freetypeScaler.c

    The patch causes a load failure when trying to load graphical java
    programs, because it created a hard dependency on libfontconfig.so from
    libfontmanager.so.  This should be handled by the JDK itself by
    dynamically loading fontconfig if it's needed.

    PR:             284503
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D48806

 java/openjdk23/Makefile                            |   1 +
 ...e_native_libfontmanager_freetypeScaler.c (gone) | 209 ---------------------
 2 files changed, 1 insertion(+), 209 deletions(-)
Comment 4 Joseph Mingrone freebsd_committer freebsd_triage 2025-03-01 20:01:10 UTC
Thanks Harald and Patrick.  Committed in 3f02459fe6b2806af3a53070c7dc54b455314cc2.