osx aarch64 binaries are in fact x86_64 binaries
Karm opened this issue · comments
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.
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.