bazelbuild / bazelisk

A user-friendly launcher for Bazel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Bazelisk Binary Does Not Respect "arch --arch arm64"

EdbertChan opened this issue · comments

When using M1 Macs, if Rosetta is enabled, we need to prepend the command "arch --arch arm64" to force a launch of an arm64 process. The use case is to build a proper arm64 Bazel binary.

However, if we build Bazel itself using Bazelisk, we will get an improper binary that is built not for arm64 as shown by the file command:

file
Mach-O 64-bit executable x86_64

To get around this, we've had to use the Python wrapper. But because this is explicitly called out as legacy code, we'd like to not have to do this.

Hash: cf1205e

Reproduction steps

  1. Build the Bazel repo with bazelisk
    arch --arch arm64 bazelisk build //src:bazel

  2. Validate the output using file
    file bazel-bin/src/bazel

  3. Make sure that the output has:
    Mach-O 64-bit executable arm64