[build] Fix LLVM build on Xcode 12.2

When building with the latest Xcode version (12.2) I found that the LLVM
build failed to build `sanitizer_platform_limits_posix.cpp` due to the `stat64`
type missing. Given we don’t need the sanitizers, I disabled building them
to work around the issue.

Example error message:
kudu/thirdparty/src/llvm-9.0.0.src/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:169:31: error: invalid application of 'sizeof' to an incomplete type 'struct stat64'
  unsigned struct_stat64_sz = sizeof(struct stat64);

Change-Id: I17ea2de460aac4142469c95af201b17554c4f751
Reviewed-on: http://gerrit.cloudera.org:8080/16746
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Reviewed-by: Andrew Wong <awong@cloudera.com>
Tested-by: Kudu Jenkins
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index e624035..fced6d4 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -284,6 +284,15 @@
         TOOLS_ARGS="$TOOLS_ARGS -DGCC_INSTALL_PREFIX=$GCC_INSTALL_PREFIX"
       fi
 
+      # Xcode 12.2 fails to buld the sanitizers and they are not needed.
+      # We disable them as a workaround to the build issues.
+      if [ -n "$OS_OSX" ]; then
+        # Disable the sanitizers and xray to prevent sanitizer_common compilation.
+        # See https://github.com/llvm-mirror/compiler-rt/blob/749af53928a31afa3111f27cc41fd15849d86667/lib/CMakeLists.txt#L11-L14
+        TOOLS_ARGS="$TOOLS_ARGS -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+        TOOLS_ARGS="$TOOLS_ARGS -DCOMPILER_RT_BUILD_XRAY=OFF"
+      fi
+
       # Depend on zlib from the thirdparty tree. It's an optional dependency for
       # LLVM, but a required [1] one for IWYU. When TSAN is enabled these flags
       # are already set by build-thirdparty.sh in order to support the