From 4cd2f81d9ef2e3b6002fcfa72a1418df6a38be16 Mon Sep 17 00:00:00 2001 From: Luben Karavelov Date: Fri, 19 Jul 2024 17:50:25 +0100 Subject: [PATCH] For Intel Mac OS target version 10.14 This is the latest Mac OS that supports 32 bit binaries so some people as staying on it. This should resolve https://github.com/luben/zstd-jni/issues/321 --- build.sbt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index a5283aa..f71ca50 100644 --- a/build.sbt +++ b/build.sbt @@ -82,11 +82,13 @@ jniGccFlags := ( jniGccFlags.value.filterNot(_ == "-fPIC") ++ Seq("-D_JNI_IMPLEMENTATION_", "-Wl,--kill-at", "-static-libgcc", "-Wl,--version-script=" + PWD + "/libzstd-jni.so.map") - else if (System.getProperty("os.name").toLowerCase startsWith "mac") + else if (System.getProperty("os.name").toLowerCase startsWith "mac") { + // For intel, target the latest version that supported 32bit binaries + val target = if (System.getProperty("os.arch") == "x86_64") Seq("-mmacosx-version-min=10.14") else Seq() // MacOS uses clang that does not support the "-static-libgcc" and version scripts, // but visibility can be modified by `-exported_symbols_list` - jniGccFlags.value ++ Seq("-exported_symbols_list", PWD + "/libzstd-jni.so.exported") - else + jniGccFlags.value ++ Seq("-exported_symbols_list", PWD + "/libzstd-jni.so.exported") ++ target + } else // the default is compilation with GCC jniGccFlags.value ++ Seq( "-static-libgcc", "-Wl,--version-script=" + PWD + "/libzstd-jni.so.map")