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

osx aarch64 binaries are in fact x86_64 binaries #1296

Closed
Karm opened this issue May 22, 2024 · 1 comment
Closed

osx aarch64 binaries are in fact x86_64 binaries #1296

Karm opened this issue May 22, 2024 · 1 comment

Comments

@Karm
Copy link

Karm commented May 22, 2024

I downloaded protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe on my M2 Pro based Mac Mini system:

karm@mandrel-macos-aarch64-1 quarkus % uname -a
Darwin mandrel-macos-aarch64-1.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64

It doesn't work as it seems it's not an aarch64 binary:

karm@mandrel-macos-aarch64-2 tmp % ./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe --something
zsh: bad CPU type in executable: ./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe

Take a look:

karm@mandrel-macos-aarch64-2 tmp % file ./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe       
./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe: Mach-O 64-bit executable x86_64

It is Mach-O 64-bit executable x86_64.

I have two identical systems available, so I installed Rosetta on the other one:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

And now I can run the executable:

karm@mandrel-macos-aarch64-1 quarkus %  ./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe --something
./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe: Unknown option: --something

So, while e.g. my Java installation is Mach-0 arm64 executable:

karm@mandrel-macos-aarch64-1 quarkus % file /Users/karm/tmp/graalvm-community-openjdk-22.0.1+8.1/Contents/Home/bin/java
/Users/karm/tmp/graalvm-community-openjdk-22.0.1+8.1/Contents/Home/bin/java: Mach-O 64-bit executable arm64

Your osx aarch64 binary ain't:

karm@mandrel-macos-aarch64-2 tmp % file ./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe       
./protoc-gen-grpc-java-1.64.0-osx-aarch_64.exe: Mach-O 64-bit executable x86_64

It has been a long time I worked with Mac OS and it is the first time I work with Mach-O arm64 executables, so take my report with a grain of salt. All in all I would assume that when I download an osx-aarch64 binary I should be able to run it without Rosetta and it is not the case with your distribution.

@ejona86
Copy link
Member

ejona86 commented May 23, 2024

Yes, the file is just copied, as a hack to allow gradle/maven to find the file. As you saw, this is grpc/grpc-java#7690, so closing this one.

@ejona86 ejona86 closed this as completed May 23, 2024
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