From 447f0126e5e0901b359f1303958888ba5fc385e6 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 26 Oct 2021 13:19:54 +0200 Subject: [PATCH] Build xcode-locator as a universal binary One of Buildbarn's users is attempting to build it on a Mac M1 system that does not have Rosetta installed: https://github.com/buildbarn/bb-remote-execution/issues/89 This currently fails with the following error message: ERROR: /external/com_google_protobuf/BUILD:130:11: Compiling src/google/protobuf/extension_set.cc failed: I/O exception during sandboxed execution: com.google.devtools.build.lib.shell.ExecFailedException: java.io.IOException: Cannot run program "/install/71ed47cad951a20fff87381f54639763/xcode-locator": error=86, Bad CPU type in executable Let's address this by shipping a copy of xcode-locator that is built both for ARM64 and x86-64. --- tools/osx/BUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/osx/BUILD b/tools/osx/BUILD index d2c0fe618dc11a..990afe3e8ce31b 100644 --- a/tools/osx/BUILD +++ b/tools/osx/BUILD @@ -29,7 +29,8 @@ exports_files([ DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """ /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \ - -framework Foundation -o $@ $< + -framework Foundation -arch arm64 -arch x86_64 -Wl,-no_adhoc_codesign -Wl,-no_uuid -o $@ $< && \ + env -i codesign --identifier $@ --force --sign - $@ """ genrule(