bazelbuild / bazelbuild/bazelisk

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

Open
#509 0 comments 0 reactions 0 assignees View on GitHub
P2 type:bug
Dominant language
Go
Stars
2.7k
Forks
424
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Bazelisk build and launch path used by `arch --arch arm64 bazelisk build //src:bazel`, then compare it with the legacy Python wrapper mentioned in the issue. Reproduce the command and inspect `bazel-bin/src/bazel` with `file`; done means it reports a Mach-O arm64 executable rather than x86_64.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.