Skip to content

Darwin ARM64 prebuilt binaries for java_tools are not compatible (ijar bad CPU type) #13944

@devversion

Description

@devversion

Description of the problem / feature request:

Currently, when using Darwin ARM64 with a remote JDK for example, the use of ijar in a Java project seems to fail. e.g.

ERROR: /private/var/tmp/_bazel_paul/4828bcaab66ebffc539d5f0797b06c19/external/io_bazel/third_party/BUILD:453:20: Extracting interface @io_bazel//third_party:guava_checked_in failed: (Exit 1): 

ijar failed: error executing command external/remote_java_tools_darwin/java_tools/ijar/ijar external/io_bazel/third_party/guava/failureaccess-1.0.1.jar ... (remaining 3 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
src/main/tools/process-wrapper-legacy.cc:80: "execvp(external/remote_java_tools_darwin/java_tools/ijar/ijar, ...)":
    Bad CPU type in executable
Target //java/com/google/copybara:copybara failed to build

I assume this happens because the prebuilt binaries are only built for Windows, Linux and macOS but there is no separation of Darwin ARM64 or x86_64. Currently only x64 binaries are being built & shipped:

bazel/tools/jdk/BUILD.tools

Lines 153 to 157 in e1c404e

for OS in [
"linux",
"darwin",
"windows",
]

How to reproduce

  1. Have a M1-based Mac
  2. Clone the copybara repository from Google: https://github.com/google/copybara
  3. Run: bazel build //java/com/google/copybara
    Note: I have been using --java_runtime_version=remotejdk_11. Down the line, the Maven runner failed with Java not being found. I have java not setup at all; only the embedded version. I set --action_env=JAVA_HOME=<bazel-output_base>/external/remotejdk11_macos_aarch64 to workaround the Maven issue

What operating system are you running Bazel on?

macOS Big Sur M1 Arm64

What's the output of bazel info release?

release 5.0.0-pre.20210826.1

(also confirmed with 4.2.0 stable)

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)platform: appleteam-Rules-JavaIssues for Java rulestype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions