Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc-3.0.0-osx-x86_64.exe": error=86, Bad CPU type in executable on Mac M1 #543

Closed
kanstantsin-bucha opened this issue Feb 3, 2022 · 4 comments

Comments

@kanstantsin-bucha
Copy link

Hi! Help will be very appreciated.
I have the issue on one of my dev's Mac. The full error is

> java.io.IOException: Cannot run program "/Users/aweinzettl/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protoc/3.0.0/31a580cdff228f572e27920c0abcfa71cd3d95e4/protoc-3.0.0-osx-x86_64.exe": error=86, Bad CPU type in executable

I believe that Mac must not run *.exe files. Because it is windows executable.
Mac can run binary files with no extension like protoc-3.0.0-osx-x86_64.

Please provide a glue -

  • is protoc-3.0.0-osx-x86_64.exe is the binary that required to be run, and I should remove the extension
  • or it is artefact and I should find out a way to remove the step that runs protoc-3.0.0-osx-x86_64 from gradle

I am not very common with the potoc for Android. The issues is very rare because for other devs all fine.

Thank you in advance!

@ejona86
Copy link
Collaborator

ejona86 commented Feb 3, 2022

Run file on the binary to see that it isn't a Windows executable. Maven Central requires artifacts to have an extension, so exe was chosen; it could have been bin just as easily.

This issue is unrelated to the gradle plugin. https://github.com/protocolbuffers/protobuf would be the more appropriate location.

Look again at the title: x86_64, Mac M1, Bad CPU type. The problem is trying to run a x86_64 binary on the ARM M1. Newer builds of protobuf have "aarch_64" versions, but they are actually just copies of the x86_64 binaries. See protocolbuffers/protobuf#8557 . To my knowledge, there aren't yet actual ARM builds of protoc available yet, but you can use the current builds with Rosetta without much problem.

@kanstantsin-bucha
Copy link
Author

@ejona86 Thank you very much!

@ejona86
Copy link
Collaborator

ejona86 commented Feb 3, 2022

Seems like this is resolved. If not, comment, and it can be reopened.

@ejona86 ejona86 closed this as completed Feb 3, 2022
@kanstantsin-bucha
Copy link
Author

The root cause: There was no Rosetta installed on the Mac. It leads to that strange errors.

How to fix: To install Rosetta use Terminal app
softwareupdate --install-rosetta --agree-to-license

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants