Skip to content

[Bug]: Fails to build on M-Series Macs without Rosetta #39

@luca-schlecker

Description

@luca-schlecker

Is there an existing issue for this?

  • I have searched the existing issues

Which use case does this bug relate to?

No response

What happened?

The build process fails because protoc-gen-grpc-java-1.73.0-osx-aarch_64.exe is in fact a x64 type binary.

Output of `./gradlew shadowJar`
> Task :checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :extractIncludeProto UP-TO-DATE
> Task :extractProto UP-TO-DATE
> Task :generateProto FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateProto'.
> protoc: stdout: . stderr: /Users/luca/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.73.0/63d0281c191ae34748e816c50afec8d82f0fa9b1/protoc-gen-grpc-java-1.73.0-osx-aarch_64.exe: program not found or is not executable
  Please specify a program using absolute path or make sure the program is available in your PATH system variable
  --grpc_out: protoc-gen-grpc: Plugin failed with status code 1.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 429ms
3 actionable tasks: 1 executed, 2 up-to-date

Steps to reproduce

  1. Be on an M-Series Mac
  2. Do not have Rosetta installed
  3. Run ./gradlew shadowJar

What did you expect?

The build process should just work™.

Anything else?

This is a known issue upstream grpc/grpc-java/issues/7690. The osx-aarch_64 binary is purposely the same as the osx-x86_64 binary, as the former one has issues being cross-compiled on non-aarch_64 machines. This lead to them implementing this workaround, breaking the build process for consumers of that specific library if Rosetta is missing.

There is a workaround, though:
The log specifies the broken file:

> protoc: stdout: . stderr: /Users/luca/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.73.0/63d0281c191ae34748e816c50afec8d82f0fa9b1/protoc-gen-grpc-java-1.73.0-osx-aarch_64.exe: program not found or is not executable

Brew has a native version of protoc-gen-grpc-java that works on both architectures. Overwriting the faulty binary with a copy of that version resolves the problem:

brew install protoc-gen-grpc-java
cp /opt/homebrew/Cellar/protoc-gen-grpc-java/1.73.0/bin/protoc-gen-grpc-java  /Users/luca/.gradle/caches/modules-2/files-2.1/io.grpc/protoc-gen-grpc-java/1.73.0/63d0281c191ae34748e816c50afec8d82f0fa9b1/protoc-gen-grpc-java-1.73.0-osx-aarch_64.exe

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions