[PATCH] D109839: Add support for targeting macOS arm64 with bazel

Dan Foreman-Mackey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 17:09:52 PDT 2021


dfm added inline comments.


================
Comment at: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel:21
+# Support for targeting macOS arm64 architecture with `bazel<4.2`. This
+# implementation is lifted from `src/conditions/BUILD` in the bazel source.
+config_setting(
----------------
GMNGeoffrey wrote:
> We already use `@bazel_tools//src/conditions:foo` in config.bzl. Looking at the history of src/conditions/BUILD, there's some bug in Bazel that means that cross-compiling from darwinn x86 to darwinn arm is broken and this is worked around in src/conditions by adding a `--darwin_arm64` flag (https://github.com/bazelbuild/bazel/issues/12655 and https://github.com/bazelbuild/bazel/commit/52457b18bd), but only after Bazel 4.0 (the version we're currently on). Is that cross-compiling something you actually need? If not, I'd prefer we use the src/conditions constraints for now (at least until such a time as we decide to define all our own config settings)
Thanks for your response! Yeah, that's exactly what we're looking to do (I came to this when trying to build binaries for a Python library using x86 hardware), although the existing implementation wouldn't work even when building on an arm machine. I also tried your suggested change (using `@bazel_tools//src/conditions:darwin_arm64`) and I was still getting the wrong compiler flags when building locally, but I'm far from an expert in any of this though so there's a good shout that I was doing something wrong. I understand the hesitation to copy this over and I'd be happy to look into alternative ideas if you have suggestions. Thanks again!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109839/new/

https://reviews.llvm.org/D109839



More information about the llvm-commits mailing list