From c74133420f6f9b4bc6b414b9c91d54cf8eb3f5af Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 18 Oct 2022 17:01:06 +0200 Subject: tdf#151545: Restrict JvmfwkUtil_isLoadableJVM to macOS x86-64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That check had been added with 32bc8ddbf335dd26019edcf12758643b4cff9913 "tdf#94716 allow Oracle's JDK to be used on OS X 10.10 and 10.11", back at a time when there was substantial trouble with installations of Apple's own Java and Oracle JREs. One consequence of that commit and its JvmfwkUtil_isLoadableJVM check was that on macOS we only supported JDKs (with a surrounding Contents directory containing an appropriate Info.plist files), not plain JREs (cf. "Prior work arounds of having both an Apple JRE 6 and an Oracle JRE 8 are no longer sufficient. Use of the JDK is now hard coded, see tdf#74877, tdf#94716 and core commit 32bc8ddbf335dd26019edcf12758643b4cff9913.") However, Apple's own Java is long since deprecated (cf. "You can also download legacy Java SE 6 from Apple if you’re using an app that specifically requires this unsupported, out-of-date version."), and presumably of no practical concern at least on contemporary Aarch64-based macOS. And there is e.g. SDKMAN! (), which installs JDKs in a way that they are not surrounded by Contents directories containing appropriate Info.plist files, so JvmfwkUtil_isLoadableJVM returned false for them and you couldn't add them on the LibreOffice Advanced Options tab. So at least for Aarch64-based macOS, drop that presumably-legacy JvmfwkUtil_isLoadableJVM check (but keep it for x86-64--based macOS at least for now, just to be safe). (That implies that for Aarch64-based macOS, it should now work again to also use plain JREs.) Change-Id: I3bcbb3c14e3a9e9dde39fd6f4572b632e05df9e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141508 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- jvmfwk/Library_jvmfwk.mk | 2 ++ jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 4 ++-- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'jvmfwk') diff --git a/jvmfwk/Library_jvmfwk.mk b/jvmfwk/Library_jvmfwk.mk index 9928b0db7c1b..64a6b9d8e396 100644 --- a/jvmfwk/Library_jvmfwk.mk +++ b/jvmfwk/Library_jvmfwk.mk @@ -58,9 +58,11 @@ $(eval $(call gb_Library_add_cxxflags,jvmfwk,\ $(gb_OBJCXXFLAGS) \ )) +ifeq ($(CPUNAME),X86_64) $(eval $(call gb_Library_add_objcxxobjects,jvmfwk,\ jvmfwk/plugins/sunmajor/pluginlib/util_cocoa \ )) +endif $(eval $(call gb_Library_add_libs,jvmfwk,\ -framework Foundation \ diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 77ea93d69592..8b9fd702397e 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -72,7 +72,7 @@ #include "sunversion.hxx" #include "diagnostics.h" -#ifdef MACOSX +#if defined MACOSX && defined __x86_64__ #include "util_cocoa.hxx" #endif @@ -625,7 +625,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( return javaPluginError::VmCreationFailed; #endif OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData); -#ifdef MACOSX +#if defined MACOSX && defined __x86_64__ if ( !JvmfwkUtil_isLoadableJVM( sRuntimeLib ) ) return javaPluginError::VmCreationFailed; #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index ce297512482c..6eb96d731c8f 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -47,7 +47,7 @@ #include "sunjre.hxx" #include "vendorlist.hxx" #include "diagnostics.h" -#ifdef MACOSX +#if defined MACOSX && defined __x86_64__ #include "util_cocoa.hxx" #endif @@ -376,8 +376,10 @@ bool getJavaProps(const OUString & exePath, } #ifdef MACOSX +#if defined __x86_64__ if (!JvmfwkUtil_isLoadableJVM(exePath)) return false; +#endif if (sClassPath.endsWith("/")) sClassPath += "../Resources/java/"; else -- cgit