Build Failure Due to Missing Protobuf Binary

I am currently trying to build a gradle project from my M1 Pro. There appears to be no protoc binary for M1’s aarch_64 architecture, and from what I’ve seen this error is thrown by the internal gradle API, not by my dependencies. I’ve included my system specs, gradle version, java version and the error below. Any suggestions would be very helpful!

System:

% uname -a
Darwin Q-DQW1D4FMXK-jjochimsen 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64

Gradle:

% gradle --version
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.16 (Eclipse Adoptium 11.0.16+8)
OS:           Mac OS X 12.5 aarch64

Java version:

% java --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment Temurin-11.0.16+8 (build 11.0.16+8)
OpenJDK 64-Bit Server VM Temurin-11.0.16+8 (build 11.0.16+8, mixed mode)

Error:

BUILD FAILED in 1s
3 actionable tasks: 1 executed, 2 up-to-date
jjochimsen@Q-DQW1D4FMXK-jjochimsen analytics % FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateProto'.
> Could not resolve all files for configuration ':protobufToolsLocator_protoc'.
   > Could not find protoc-3.3.0-osx-aarch_64.exe (com.google.protobuf:protoc:3.3.0).
     Searched in the following locations:
         https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.3.0/protoc-3.3.0-osx-aarch_64.exe

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s

Any and all help is much appreciated!

Looks like you’re using Google’s protobuf plugin and indeed protoc version 3.3.0 does not have an osx-aarch_64 variant. Central Repository: com/google/protobuf/protoc/3.3.0

However, newer publications of protoc do. For example, the latest version Central Repository: com/google/protobuf/protoc/3.21.5

Try specifying newer protoc version GitHub - google/protobuf-gradle-plugin: Protobuf Plugin for Gradle

1 Like