bazel-contrib / bazel-lib

Common useful functions for writing BUILD files and Starlark macros/rules
Apache License 2.0
134 stars 88 forks source link

[Bug]: coreutils: Bad CPU type in executable (macOS Ventura arm64) #519

Open yesudeep opened 1 year ago

yesudeep commented 1 year ago

What happened?

Not sure whether this is the correct place to file this bug, but since it appears to be linked to bazel-lib, I've filed it here.

zsh❯ bazel build ...
...
ERROR: /Users/someone/code/github.com/someone/pooc/pooc/service/tasks/BUILD.bazel:88:16: OCI Index //pooc/service/tasks:image_index failed: (Exit 1): image_index_image_index.sh failed: error executing command (from target //pooc/service/tasks:image_index)
  (cd /private/var/tmp/_bazel_someone/e983ed3644b94975c3661ef790624b51/sandbox/darwin-sandbox/335/execroot/_main && \
  exec env - \
  bazel-out/darwin_arm64-fastbuild/bin/pooc/service/tasks/image_index_image_index.sh '--output=bazel-out/darwin_arm64-fastbuild/bin/pooc/service/tasks/image_index' '--image=bazel-out/darwin_arm64-fastbuild/bin/pooc/service/tasks/image' '--blob=blobs/sha256/26e3e4b0848c0e87391a7a844b11fcd2e6d223bd516be6ac8b17bac4e6808609' '--blob=blobs/sha256/6b0b1527d75b1e49c2cb08f4eb8616c64c9a20a8b9d8c1179146b2675586536b' '--blob=blobs/sha256/b63d80d60c9a85a9d668b129d83d702130f57252d71b3d7a55f920b02609c13a' '--blob=blobs/sha256/da835c1b81c4c0115cba35011059fa3777c37f91329ca2a1237e8d012865267c' '--blob=blobs/sha256/fa52a70d697454bd2523fcb8adf3d49325c4de2765832a26b64d43ee196887e0')
# Configuration: b8449cf680a0a1d547ca59c1a71a3fef8f742ddaca4ac17505d2a30cb32c0503
# Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bazel-out/darwin_arm64-fastbuild/bin/pooc/service/tasks/image_index_image_index.sh: line 11: external/aspect_bazel_lib~1.32.1~ext~coreutils_darwin_arm64/coreutils: Bad CPU type in executable
ERROR: /Users/someone/code/github.com/someone/pooc/BUILD.bazel:10:22: Error while validating output TreeArtifact File:[[<execution_root>]bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin]node_modules/.aspect_rules_js/react-dom@18.2.0_react_18.2.0/node_modules/react-dom : java.lang.InterruptedException
INFO: Elapsed time: 45.786s, Critical Path: 9.08s
INFO: 1060 processes: 712 internal, 189 darwin-sandbox, 150 local, 9 worker.
FAILED: Build did NOT complete successfully

Version

Development (host) and target OS/architectures:

macOS Ventura

zsh❯ uname -a
Darwin host 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:53 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 arm64

Output of bazel --version:

 bazel --version
bazel 6.3.2

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file:

bazel_dep(
    name = "rules_pkg",
    version = "0.9.1",
)
bazel_dep(
    name = "rules_oci",
    version = "1.3.2",
)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
    name = "distroless_base",
    digest = "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86",
    image = "gcr.io/distroless/base",
    platforms = [
        "linux/amd64",
        "linux/arm64",
    ],
)
use_repo(oci, "distroless_base")

Language(s) and/or frameworks involved: Java used to implement a a gRPC service

How to reproduce

Just try to build an image on macOS arm64 without Rosetta installed.

Any other information?

How to work around:

What possibly (temporarily?) fixed this by accident for me is installing Rosetta. Suddenly, this stopped failing.

thesayyn commented 1 year ago

blocked on https://github.com/uutils/coreutils/issues/4104