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

Bad CPU type in executable protoc-jar #227

Open
andygrove opened this issue Mar 23, 2024 · 8 comments
Open

Bad CPU type in executable protoc-jar #227

andygrove opened this issue Mar 23, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@andygrove
Copy link
Member

andygrove commented Mar 23, 2024

Describe the bug

I am trying to build Comet on a new Macbook Pro M3 Max and I am running into this error:

Cannot run program "/Users/andy/protoc5660975561245775818.exe": error=86, Bad CPU type in executable

Steps to reproduce

I installed openjdk@17 and protoc using homebrew. I am using the following command to build the project.

make release PROFILES="-Pspark-3.4"

Here is some of the log output:

Downloaded from central: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.19.6/protoc-3.19.6-osx-aarch_64.exe (12 MB at 1.6 MB/s)
protoc-jar: executing: [/var/folders/vv/fmb1n2hx3yqdmxbrv7shzyvr0000gn/T/protoc1458461729440081482.exe, --version]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/var/folders/vv/fmb1n2hx3yqdmxbrv7shzyvr0000gn/T/protoc1458461729440081482.exe": error=86, Bad CPU type in executable

Expected behavior

No response

Additional context

No response

@andygrove andygrove added the bug Something isn't working label Mar 23, 2024
@viirya
Copy link
Member

viirya commented Mar 23, 2024

Hmm, I'm also using M3 Max, but I don't see the issue.

java --version
openjdk 11.0.22 2024-01-16
OpenJDK Runtime Environment Homebrew (build 11.0.22+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.22+0, mixed mode)

Is it possible that you installed x86 JDK?

And, from the error message,

Downloaded from central: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.19.6/protoc-3.19.6-osx-aarch_64.exe (12 MB at 1.6 MB/s)
protoc-jar: executing: [/var/folders/vv/fmb1n2hx3yqdmxbrv7shzyvr0000gn/T/protoc1458461729440081482.exe, --version]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/var/folders/vv/fmb1n2hx3yqdmxbrv7shzyvr0000gn/T/protoc1458461729440081482.exe": error=86, Bad CPU type in executable

Looks like it tries to run x86 protoc?

@viirya
Copy link
Member

viirya commented Mar 23, 2024

And do you have Xcode installed?

@andygrove
Copy link
Member Author

I do have xcode installed. I tried with openjdk 11 as well.

% java --version 
openjdk 11.0.22 2024-01-16
OpenJDK Runtime Environment Homebrew (build 11.0.22+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.22+0, mixed mode)

It seems to be arm64 build:

% file /opt/homebrew/Cellar/openjdk@11/11.0.22/bin/javac
/opt/homebrew/Cellar/openjdk@11/11.0.22/bin/javac: Mach-O 64-bit executable arm64

I also have protoc installed and seems to be arm64 version:

 % file /opt/homebrew/bin/protoc
/opt/homebrew/bin/protoc: Mach-O 64-bit executable arm64

I still see the same issue 😕

@viirya
Copy link
Member

viirya commented Mar 23, 2024

Is it possible due to this protocolbuffers/protobuf#8557?

@viirya
Copy link
Member

viirya commented Mar 23, 2024

Do you install protobuf using Homebrew? This version protoc should be used instead of the downloaded one "/var/folders/vv/fmb1n2hx3yqdmxbrv7shzyvr0000gn/T/protoc1458461729440081482.exe".

@andygrove
Copy link
Member Author

andygrove commented Mar 23, 2024

I tried installing protobuf with homebrew as well as manually. In either case, maven runs the downloaded one, which is not really an arm64 build even though it pretends to be.

As a workaround, I ran the following comment to enable x86 compatibility mode (as suggested in protocolbuffers/protobuf#8557) and the build now works.

softwareupdate --install-rosetta

@viirya
Copy link
Member

viirya commented Mar 23, 2024

Hmm, it's weird. I don't remember I've installed rosetta. @sunchao Do you have it?

@sunchao
Copy link
Member

sunchao commented Mar 23, 2024

I don't think I installed Rosetta either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants