bazelbuild / bazelisk

A user-friendly launcher for Bazel.
Apache License 2.0
1.96k stars 302 forks source link

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

Open EdbertChan opened 8 months ago

EdbertChan commented 8 months ago

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