This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3bba8a3365 Point JNI includes at the JDK on macOS, not the dead 
JavaVM.framework
3bba8a3365 is described below

commit 3bba8a336586a3e54411e8bf01663d73d200e263
Author: Jim Jagielski <[email protected]>
AuthorDate: Thu Jun 11 17:21:31 2026 -0400

    Point JNI includes at the JDK on macOS, not the dead JavaVM.framework
    
    jvmaccess (and any JNI consumer) fails to compile on modern macOS:
    
        jvmaccess/inc/jvmaccess/virtualmachine.hxx:32: fatal error: 'jni.h' 
file not found
    
    set_soenv.in's darwin branch added the JNI headers from
    $MACOSX_SDK_PATH/System/Library/Frameworks/JavaVM.framework/Headers. That is
    Apple's old bundled-Java layout, removed ~2017; the framework no longer 
ships
    jni.h. A real JDK (Oracle/OpenJDK/Temurin/Semeru, e.g. via --with-jdk-home)
    puts the headers in $JAVA_HOME/include and $JAVA_HOME/include/darwin
    (jni_md.h) -- the same include/<os> layout already used for 
Linux/Solaris/BSD.
    
    Add those two dirs to SOLARINC on darwin (guarded by the same JDK!=gcj check
    as the other platforms) and drop the dead framework path. FRAMEWORKSHOME is
    still set/exported for other framework references. Verified the generated
    -I paths resolve to the existing jni.h/jni_md.h of an installed JDK 21.
---
 main/set_soenv.in | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/main/set_soenv.in b/main/set_soenv.in
index 688e832bc4..2351ef600f 100644
--- a/main/set_soenv.in
+++ b/main/set_soenv.in
@@ -1522,7 +1522,15 @@ elsif ($platform =~ m/darwin/)
           # Xcode 5
           $STLINC = 
"$TOOLSPATH/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/";
        }
-    $SOLARINC .= $I.$STLINC . 
$I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Headers";
+    $SOLARINC .= $I.$STLINC;
+    # JNI headers.  The old Apple JavaVM.framework/Headers/jni.h is gone
+    # (removed by Apple ~2017); a real JDK (Oracle/OpenJDK/Temurin/Semeru)
+    # puts them in $JAVA_HOME/include and $JAVA_HOME/include/darwin (jni_md.h),
+    # matching the layout used for the other platforms above.
+    if (!($JDK eq "gcj"))
+    {  $SOLARINC .= $I.'$JAVA_HOME'.$INCLUDE.
+                    $I.'$JAVA_HOME'.$INCLUDE.$ds."darwin";
+    }
     $GUIBASE  = "aqua";
 }
 else

Reply via email to