bazelbuild / bazelbuild/bazel

Wrong CPU detection on MacOS arm64

Open
#15,555 1 comment 0 reactions 1 assignee Claimed by @meteorcloudy View on GitHub
P2 team-OSS type: support / not a bug (process)
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

Current master version gives wrong (AFAIK) `cpu` value for **MacOS arm64**. This is not the case for version `5.0.0`.

This makes other select rules to fail.

### Master version configuration (example protobuf)

```bash
❯ cat .bazelversion
a5e66fafc9d1f9eb192bc157396040b6c95be5cf

❯ bazel cquery '@com_google_protobuf//:protoc'
2022/05/23 17:39:11 Using unreleased version at commit a5e66fafc9d1f9eb192bc157396040b6c95be5cf
WARNING: Option 'host_javabase' is deprecated
INFO: Invocation ID: 24b90294-4f7e-41e5-883f-b7f2318db3ed
DEBUG: /Users/xdev/.cache/bazel/fc7c18fb53b8d51e4a6f9440a6cadab3/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:59:14:
Current running Bazel is not a release version and one was not defined explicitly in rbe_autoconfig target. Falling back to '4.0.0'
DEBUG: /Users/xdev/.cache/bazel/fc7c18fb53b8d51e4a6f9440a6cadab3/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:113:18: rbe_ubuntu2004 not using checked in configs; registry was set to 'registry.gitlab.com' and toolchain_config_suite_spec is configured for 'marketplace.gcr.io'
DEBUG: Rule 'com_grail_bazel_toolchain' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1642510768 +0100"
DEBUG: Repository com_grail_bazel_toolchain instantiated at:
/Users/xdev/main/WORKSPACE:277:15: in
Repository rule git_repository defined at:
/Users/xdev/.cache/bazel/fc7c18fb53b8d51e4a6f9440a6cadab3/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in
INFO: Analyzed target @com_google_protobuf//:protoc (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
@com_google_protobuf//:protoc (a022921)
INFO: Elapsed time: 0.235s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions

❯ bazel config a022921 | grep cpu
2022/05/23 17:39:16 Using unreleased version at commit a5e66fafc9d1f9eb192bc157396040b6c95be5cf
WARNING: Option 'host_javabase' is deprecated
INFO: Invocation ID: e994cdff-b4e2-4fea-9663-1e19e0d880ca
INFO: Displaying config with id a022921
auto_cpu_environment_group: null
cpu: darwin
host_cpu: darwin
android_cpu: armeabi-v7a
fat_apk_cpu: [armeabi-v7a]
apple_split_cpu:
catalyst_cpus: []
ios_cpu: x86_64
ios_multi_cpus: []
macos_cpus: []
tvos_cpus: []
watchos_cpus: []
incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain: true
```

### v5.0.0 version configuration (example protobuf)

```bash
❯ cat .bazelversion
5.0.0

❯ bazel cquery '@com_google_protobuf//:protoc'
Starting local Bazel server and connecting to it...
WARNING: Option 'host_javabase' is deprecated
INFO: Invocation ID: de7b6a39-b693-4da8-a0a8-3175304595c1
DEBUG: /Users/xdev/.cache/bazel/fc7c18fb53b8d51e4a6f9440a6cadab3/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14:
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /Users/xdev/.cache/bazel/fc7c18fb53b8d51e4a6f9440a6cadab3/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:113:18: rbe_ubuntu2004 not using checked in configs; registry was set to 'registry.gitlab.com' and toolchain_config_suite_spec is configured for 'marketplace.gcr.io'
DEBUG: Rule 'com_grail_bazel_toolchain' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1642510768 +0100"
DEBUG: Repository com_grail_bazel_toolchain instantiated at:
/Users/xdev/main/WORKSPACE:277:15: in
Repository rule git_repository defined at:
/Users/xdev/.cache/bazel/fc7c18fb53b8d51e4a6f9440a6cadab3/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in
INFO: Analyzed target @com_google_protobuf//:protoc (61 packages loaded, 830 targets configured).
INFO: Found 1 target...
@com_google_protobuf//:protoc (58db6ce)
INFO: Elapsed time: 9.680s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions

❯ bazel config 58db6ce | grep cpu
WARNING: Option 'host_javabase' is deprecated
INFO: Invocation ID: 7732f750-f9b8-44a0-99fe-2c3ed473e1e1
INFO: Displaying config with id 58db6ce
auto_cpu_environment_group: null
cpu: darwin_arm64
host_cpu: darwin_arm64
android_cpu: armeabi-v7a
fat_apk_cpu: [armeabi-v7a]
apple_split_cpu:
catalyst_cpus: []
ios_cpu: x86_64
ios_multi_cpus: []
macos_cpus: []
tvos_cpus: []
watchos_cpus: []
incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain: true
```

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

what's shown above

### Which operating system are you running Bazel on?

Darwin 21.5.0 arm64 arm

### What is the output of `bazel info release`?

❯ bazel info release 2022/05/23 17:56:59 Using unreleased version at commit a5e66fafc9d1f9eb192bc157396040b6c95be5cf Starting local Bazel server and connecting to it... WARNING: Option 'host_javabase' is deprecated INFO: Invocation ID: 5cb4a7ca-84a3-4cc0-94bb-aa908d46219c development version

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

I use bazelisk

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.