From 7307eb250072e4d9626c2dac6471cafe27c859f6 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Sat, 12 Feb 2022 16:12:35 -0800 Subject: [PATCH] fix build to work on Apple M1 machines --- build.sbt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2582ff6f58..89f732c761 100644 --- a/build.sbt +++ b/build.sbt @@ -310,7 +310,21 @@ lazy val zincPersistCore = (project in internalPath / "zinc-persist-core") exportJars := true, ProtobufConfig / version := "3.11.4", // sync version w/ plugins.sbt ProtobufConfig / protobufRunProtoc := { args => - Protoc.runProtoc(s"-v${(ProtobufConfig / version).value}" +: args.toArray) + // as per https://github.com/os72/protoc-jar/issues/93 , this is needed + // to work around the lack of support for Apple M1 architecture. + // (there is an upstream fix, but as of February 2022 there is no + // protoc-jar release containing the fix) + val workaround = + System.getProperty("os.name") == "Mac OS X" && + System.getProperty("os.arch") == "aarch64" + try { + if (workaround) + System.setProperty("os.arch", "x86_64") + Protoc.runProtoc(s"-v${(ProtobufConfig / version).value}" +: args.toArray) + } + finally + if (workaround) + System.setProperty("os.arch", "aarch64") }, publish / skip := true, assembly / assemblyShadeRules := Seq(