grpc-java: protoc-gen-grpc-java not available on apple m1
What version of gRPC-Java are you using?
1.34.0
What is your environment?
osx 11.0.1
What did you expect to see?
build success
What did you see instead?
[INFO] --- protobuf-maven-plugin:0.6.1:compile (default-cli) @ grpc ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.720 s
[INFO] Finished at: 2020-12-03T16:37:02+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default-cli) on project grpc: Unable to resolve artifact: Missing:
[ERROR] ----------
[ERROR] 1) com.google.protobuf:protoc:exe:osx-aarch_64:3.12.0
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.12.0 -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.12.0 -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) com.reinmind:grpc:jar:1.0-SNAPSHOT
[ERROR] 2) com.google.protobuf:protoc:exe:osx-aarch_64:3.12.0
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] com.reinmind:grpc:jar:1.0-SNAPSHOT
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] aliyunmaven (https://maven.aliyun.com/repository/public, releases=true, snapshots=false)
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Steps to reproduce the bug
mvn protobuf:compile
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 27
- Comments: 93 (23 by maintainers)
Commits related to this issue
- Added workaround for protoc on Apple Silicon Just a workaround. Track https://github.com/grpc/grpc-java/issues/7690 and https://github.com/protocolbuffers/protobuf/pull/8557 for permanent fix — committed to drasyl/drasyl by KevinRoebert 3 years ago
- protoc-gen-grpc-java not available on apple m1. Add workaround as suggested here : https://github.com/grpc/grpc-java/issues/7690#issuecomment-760619366 — committed to azimbabu/grpc-up-and-running by azimbabu 2 years ago
- Support Apple Chip for protoc * See https://github.com/grpc/grpc-java/issues/7690 — committed to emeraldhieu/vinci by emeraldhieu a year ago
- Sync appropriate protoc artifact for m1 Fixes compilation on M1 macOS. Check https://github.com/grpc/grpc-java/issues/7690 for further info Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com> — committed to theimpulson/seedvault by theimpulson a year ago
- Sync appropriate protoc artifact for m1 Fixes compilation on M1 macOS. Check https://github.com/grpc/grpc-java/issues/7690 for further info Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com> — committed to theimpulson/seedvault by theimpulson a year ago
- Sync appropriate protoc artifact for m1 Fixes compilation on M1 macOS. Check https://github.com/grpc/grpc-java/issues/7690 for further info Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com> — committed to theimpulson/seedvault by theimpulson a year ago
- work-around old protobuf:protoc on Apple Silicon Use x86_64 protobuf compilers on macOS until protobuf is updated to a newer version (~3.21.0). See https://github.com/grpc/grpc-java/issues/7690 for m... — committed to tmancill/JVoiceXML by tmancill 10 months ago
- work-around old protobuf:protoc on Apple Silicon Use x86_64 protobuf compilers on macOS until protobuf is updated to a newer version (~3.21.0). See https://github.com/grpc/grpc-java/issues/7690 for m... — committed to tmancill/JVoiceXML by tmancill 10 months ago
- Sync appropriate protoc artifact for m1 Fixes compilation on M1 macOS. Check https://github.com/grpc/grpc-java/issues/7690 for further info Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com> — committed to seedvault-app/seedvault by theimpulson a year ago
- Sync appropriate protoc artifact for m1 Fixes compilation on M1 macOS. Check https://github.com/grpc/grpc-java/issues/7690 for further info Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com> — committed to AndreiFlorea04/seedvault by AndreiFlorea04 a year ago
To manually specify the classifier, for Gradle:
I’m less familiar with the Maven plugin, but I think it may be something like:
You can do the same for protoc-gen-grpc-java.
for me, add this to
~/.m2/settings.xml
, it worked:@Jiachen-Zhang
You can also use project properties to only change the behavior when explicitly requested.
@guyeu my seetings.xml file
@Uditmittal in my
build.gradle
filein my
~/.gradle/gradle.properties
fileI think you can define and use variables in maven to implement this feature. Good luck
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
It is now May 2023 and none of the above methods work. This command solved my problem.@Uditmittal This is my
org.xolstice.maven.plugins:protobuf-maven-plugin
build plugin configuration, the${os.detected.classifier}
value could read from active profile fromsettings.xml
.Thanks!
Finally, I made it by
https://github.com/protocolbuffers/protobuf/pull/8557 just went into protobuf based on my suggestion to just copy the current x86 binary to an arm64 name until we have actual M1 support. That doesn’t “fix” this, but it does resolve the main user-visible issues and doesn’t turn out to be too hacky.
I think that is as simple as making a copy of the “exe” and the hashes/signature in our upload_artifacts.sh script.
@ejona86 do you know when the
protoc-gen-grpc-java_xxx_osx_aarch64
build of will be fixed? As of nowosx_aarch
andosx_x86-84
are the same binary which is not compatible with M1 CPU:Source: https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.51.1/
I suspect it’s not big deal for infra team to make a proper build for that artifact since
protoc-xxx-osx-aarch_64.exe
was built correctly: https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.21.9/Am I right that @deannagarcia could do that? https://github.com/protocolbuffers/protobuf/issues/9397#issuecomment-1124400911
If it’s impossible to provide correct
aarch64
builds ofprotoc-gen-grpc-java
please remove it from artifact publishing to not mislead end users.Yes, we do not produce binaries for arm64 macs.
Edit: Summary of the long issue: The easiest thing to do as a consumer is to install Rosetta. With it installed, the Intel binary works fine. If you’d like to contribute, see https://github.com/grpc/grpc-java/issues/7690#issuecomment-831617279 . Easiest plan is to build protobuf and the grpc plugin as universal binaries.
zsh: bad CPU type in executable: ./protoc-gen-grpc-java-osx-aarch_64.exe
can not executable on mac m2 chips version: protoc-gen-grpc-java-1.58.0-osx-aarch_64.exe
Interactions with the protobuf plugins is resolved, but requires Rosetta. I reopened the issue to track native M1 support.
@ejona86 I’ve had a look at the repo and created a very simple PR #8680 . No idea if it works but maybe this gets things rolling?
@ejona86 Where do I beg to get
protoc-gen-grpc-java
published asosx-aarch_64
?This is the lone holdout of 3 projects (including
com.google.protobuf:protoc
) required for building easily on the M1. The other projects seem to be following the advice of copyingosx-x86_64
toosx-aarch_64
and it works well. I currently do this manually on my machine to get the requiredprotoc-gen-grpc-java:osx-aarch_64
artifact.https://github.com/protocolbuffers/protobuf/issues/9397#issuecomment-1535044692 🥳
please adjust plugin configuration to something like this
my output
@MochiXu, I expect you’re just missing a place in your build that you need to make the change. There’s not much way to help you without seeing your build. That said, that recommendation of mine is pretty old. Since protobuf v3.17.3, protobuf has been copying the osx-x86_64 artifact to osx-aarch_64 meaning you wouldn’t need configuration in your build. So these days I’d recommend you just upgrade to a newer protobuf.
Reopening because we’ve only a workaround currently. We still need to do something along the lines of https://github.com/grpc/grpc-java/issues/7690#issuecomment-831617279 for native M1 support. I thought we had another issue open for tracking native M1 support, but I can’t find it. Anyway, this will do.