<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.freebsd.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.freebsd.org/bugzilla/"
          
          maintainer="bugmeister@FreeBSD.org"
>

    <bug>
          <bug_id>297282</bug_id>
          
          <creation_ts>2026-08-04 19:55:23 +0000</creation_ts>
          <short_desc>java/openjdk25: libjava.so does not find libjvm.so</short_desc>
          <delta_ts>2026-09-01 08:00:02 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Ports &amp; Packages</product>
          <component>Individual Port(s)</component>
          <version>Latest</version>
          <rep_platform>Any</rep_platform>
          <op_sys>Any</op_sys>
          <bug_status>Closed</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>Affects Only Me</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Thierry Thomas">thierry</reporter>
          <assigned_to name="freebsd-java (Nobody)">java</assigned_to>
          <cc>haraldei</cc>
    
    <cc>ronald</cc>
    
    <cc>vvd</cc>
          

      

      

      <flag name="maintainer-feedback"
          id="100603"
          type_id="3"
          status="?"
          setter="bugzilla"
          requestee="java"
    />

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1437575</commentid>
    <comment_count>0</comment_count>
    <who name="Thierry Thomas">thierry</who>
    <bug_when>2026-08-04 19:55:23 +0000</bug_when>
    <thetext>On 16-CURRENT I&apos;m using openjdk25 installed by pkg:
        FreeBSD_version: 1600019
        build_timestamp: 2026-07-25T01:04:44+0000
        built_by       : poudriere-git-3.4.8
        cpe            : cpe:2.3:a:oracle:openjdk:25.0.3+9.f.1:::::freebsd16:x64
        flavor         : jdk
        port_checkout_unclean: no
        port_git_hash  : a775e64d13a6bb7f4e5133105227f37fdc87a882
        ports_top_checkout_unclean: no
        ports_top_git_hash: 7c53142d6b1d65fc3b37c1ce6ee6b703206261e2
        repo_type      : binary
        repository     : FreeBSD-ports

and it seems linked against openjdk11:

$ ldd /usr/local/openjdk25/lib/libjava.so
/usr/local/openjdk25/lib/libjava.so:
        libjvm.so =&gt; /usr/local/openjdk11/lib/server/libjvm.so (0x1290b8e00000)
        libdl.so.1 =&gt; /usr/lib/libdl.so.1 (0x1290ba54d000)
        libc.so.7 =&gt; /lib/libc.so.7 (0x1290b763b000)
        libm.so.5 =&gt; /lib/libm.so.5 (0x1290b6423000)
        libc++.so.1 =&gt; /lib/libc++.so.1 (0x1290ba700000)
        libcxxrt.so.1 =&gt; /lib/libcxxrt.so.1 (0x1290bb289000)
        libthr.so.3 =&gt; /lib/libthr.so.3 (0x1290bbe74000)
        libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0x1290bbf95000)
        libsys.so.7 =&gt; /lib/libsys.so.7 (0x1290b7b74000)

Actually, openjdk11 is installed on this machine. After removing it, ldd reports a missing libjvm.so:

$ ldd /usr/local/openjdk25/lib/libjava.so
/usr/local/openjdk25/lib/libjava.so:
        libjvm.so =&gt; not found (0)
        libdl.so.1 =&gt; /usr/lib/libdl.so.1 (0x3721ac186000)
        libc.so.7 =&gt; /lib/libc.so.7 (0x3721ad00c000)

Same thing on another machine running 15.1-RELEASE.

libjvm.so exists for OpenJDK25, it is installed as
/usr/local/openjdk25/lib/server/libjvm.so
but I guess that the linker missed some LDFLAGS with &quot;-Wl,-rpath=$JAVA_HOME/lib/server&quot;.

With LD_LIBRARY_PATH=/usr/local/openjdk25/lib/server everything is OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1438400</commentid>
    <comment_count>1</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-10 09:44:29 +0000</bug_when>
    <thetext>Thanks for reporting! I&apos;ll look into it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1438722</commentid>
    <comment_count>2</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-12 10:34:07 +0000</bug_when>
    <thetext>The problem seems to be that while libjava.so is located in /usr/local/openjdkXX/lib, libjvm.so is located in /usr/local/openjdkXX/lib/server (assuming the server build, which is the default.)

However, the DT_RUNPATH of libjava.so is set only to `$ORIGIN`, which makes the loader not look in the `server/` directory under it. 

    stigmata% readelf -d /usr/local/openjdk25/lib/libjava.so|grep &apos;R.*PATH&apos;
      0x000000000000001d (RUNPATH)    Library runpath: [$ORIGIN]

Adding `$ORIGIN/server` to the library runpath seems to solve the issue.

I still don&apos;t understand why it insist on picking OpenJDK11 as the default, though.

A bit more work is needed to make the patch more generic, but I hope to be able to update the ports within the week or early next week.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1439102</commentid>
    <comment_count>3</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-14 10:27:24 +0000</bug_when>
    <thetext>Went for a different approach instead, removed the USE_LDCONFIG line from the OpenJDK8 and 11 ports. This will make ldd report that it can&apos;t find libjvm.so regardless of which jdk version are installed. Since OpenJDK loads the libs explicitly at runtime, this should not be a problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1439103</commentid>
    <comment_count>4</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-14 10:28:05 +0000</bug_when>
    <thetext>Forgot the link to the review: https://reviews.freebsd.org/D58841</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1439613</commentid>
    <comment_count>5</comment_count>
    <who name="">commit-hook</who>
    <bug_when>2026-08-17 10:26:28 +0000</bug_when>
    <thetext>A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9477c9da0a436a689b99443372a80f20186ee7a9

commit 9477c9da0a436a689b99443372a80f20186ee7a9
Author:     Harald Eilertsen &lt;haraldei@FreeBSD.org&gt;
AuthorDate: 2026-08-14 10:19:14 +0000
Commit:     Harald Eilertsen &lt;haraldei@FreeBSD.org&gt;
CommitDate: 2026-08-17 10:25:52 +0000

    java/openjdk{8,11}: Remove USE_LDCONFIG from ports

    OpenJDK loads the JVM and other JDK libraries explicitly from the
    correct directories, so there&apos;s no need for adding them to ldconfig.

    PR:             297282
    Reviewed by:    jrm
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D58841

 java/openjdk11/Makefile | 2 +-
 java/openjdk8/Makefile  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1439614</commentid>
    <comment_count>6</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-17 10:32:00 +0000</bug_when>
    <thetext>This issue should be fixed in the ports main branch now. Let me know if I can close the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1440919</commentid>
    <comment_count>7</comment_count>
    <who name="Thierry Thomas">thierry</who>
    <bug_when>2026-08-25 12:44:05 +0000</bug_when>
    <thetext>Yes, everything seems clean now, thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441440</commentid>
    <comment_count>8</comment_count>
    <who name="Vladimir Druzenko">vvd</who>
    <bug_when>2026-08-27 21:11:22 +0000</bug_when>
    <thetext>This change causes a breakage of the databases/sqldeveloper:
https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/pe66ef70ebb36_sc54fbc9e83/logs/sqldeveloper-24.3.1.347.1826_3.log</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441468</commentid>
    <comment_count>9</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-28 07:33:19 +0000</bug_when>
    <thetext>(In reply to Vladimir Druzenko from comment #8)
Yes, I&apos;m looking into that now. I can reproduce the issue in poudriere, but building by running make directly in the ports tree seems to work.

We should perhaps have a separate ticket for this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441498</commentid>
    <comment_count>10</comment_count>
    <who name="Ronald Klop">ronald</who>
    <bug_when>2026-08-28 11:28:48 +0000</bug_when>
    <thetext>(In reply to Harald Eilertsen from comment #9)
This is a port specific issue and comes from a change in library handling of pkg.

Multiple Java ports needed NO_SHLIB_REQUIRES_GLOB after the pkg change.
See also bug #293874.
The exp-run for the pkg change didn&apos;t catch the problems for openjdk8/11 ports because they had ldconfig apparently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441957</commentid>
    <comment_count>11</comment_count>
    <who name="Harald Eilertsen">haraldei</who>
    <bug_when>2026-08-31 15:51:02 +0000</bug_when>
    <thetext>(In reply to Ronald Klop from comment #10)
Thanks a lot! That seems to fix the issue. Just testing a bit more and I&apos;ll submit a patch for review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1442047</commentid>
    <comment_count>12</comment_count>
    <who name="">commit-hook</who>
    <bug_when>2026-09-01 08:00:02 +0000</bug_when>
    <thetext>A commit in branch main references this bug:

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

commit cfb60c1505c9a395c6361472c4a0628b2f77e9fc
Author:     Harald Eilertsen &lt;haraldei@FreeBSD.org&gt;
AuthorDate: 2026-08-31 15:48:25 +0000
Commit:     Harald Eilertsen &lt;haraldei@FreeBSD.org&gt;
CommitDate: 2026-09-01 07:59:20 +0000

    java/openjfx14: Fix openjfx14 after 9477c9da0a4

    Removing USE_LDCONFIG from openjdk11 caused the package for openjfx14 to
    fail to build, because it could not find libjvm.so, previously exported
    from openjdk11 (and 8).

    Making the openjfx14 package ignore this should be safe, as it in any
    case relies on openjdk11 which again contains the lib and knows how to
    locate and load it.

    Thanks to ronald@ for pointing me in the right direction!

    PR:             297282
    Reported by:    vvd@FreeBSD.org
    Reviewed by:    vvd@FreeBSD.org
    Tested by:      vvd@FreeBSD.org
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59290

 java/openjfx14/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>