Skip to content

Support for M1 Macs (osx-aarch_64) #99

@cmardini

Description

@cmardini

Here's some output from the protoc-jar-maven-plugin on an M1 Mac:

% java -jar ~/.m2/repository/com/github/os72/protoc-jar-maven-plugin/3.11.4/protoc-jar-maven-plugin-3.11.4.jar   
protoc-jar: protoc version: 3.11.4, detected platform: osx-aarch_64 (mac os x/aarch64)
protoc-jar: cached: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: cached: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/github/os72/protoc/maven-metadata.xml
protoc-jar: cached: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.11.4/protoc-3.11.4-osx-aarch_64.exe
protoc-jar: cached: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/github/os72/protoc/maven-metadata.xml
protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/github/os72/protoc/3.11.4/protoc-3.11.4-osx-aarch_64.exe
protoc-jar: java.io.FileNotFoundException: Unsupported platform: protoc-3.11.4-osx-aarch_64.exe
java.io.FileNotFoundException: Unsupported platform: protoc-3.11.4-osx-aarch_64.exe
	at com.github.os72.protocjar.Protoc.extractProtoc(Protoc.java:223)
	at com.github.os72.protocjar.Protoc.extractProtoc(Protoc.java:184)
	at com.github.os72.protocjar.Protoc.runProtoc(Protoc.java:68)
	at com.github.os72.protocjar.Protoc.runProtoc(Protoc.java:55)
	at com.github.os72.protocjar.Protoc.main(Protoc.java:45)

Or from protoc-jar:

% java -jar .m2/repository/com/github/os72/protoc-jar/3.11.4/protoc-jar-3.11.4.jar -pp
------------------------------------------------------------------------
Detecting the operating system and CPU architecture
------------------------------------------------------------------------
os.detected.name: osx
os.detected.arch: aarch_64
os.detected.version: 11.1
os.detected.version.major: 11
os.detected.version.minor: 1
os.detected.classifier: osx-aarch_64
Detected platform: osx-aarch_64 (mac os x/aarch64)

Or from my maven build:

[INFO] --- protoc-jar-maven-plugin:3.11.4:run (default) @ webapi-grpc-clients ---
[INFO] Protoc version: 3.11.0
protoc-jar: protoc version: 3.11.0, detected platform: osx-aarch_64 (mac os x/aarch64)
protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: saved: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/github/os72/protoc/maven-metadata.xml
protoc-jar: saved: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/github/os72/protoc/maven-metadata.xml
protoc-jar: cached: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.11.0/protoc-3.11.0-osx-aarch_64.exe
protoc-jar: cached: /var/folders/gq/883qwjg91_x4pyq995m7vct40000gn/T/protocjar.webcache/com/github/os72/protoc/maven-metadata.xml
protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/github/os72/protoc/3.11.0/protoc-3.11.0-osx-aarch_64.exe
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.323 s
[INFO] Finished at: 2021-01-05T09:25:11-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.os72:protoc-jar-maven-plugin:3.11.4:run (default) on project webapi-grpc-clients: Error extracting protoc for version 3.11.0: Unsupported platform: protoc-3.11.0-osx-aarch_64.exe -> [Help 1]

I should be able to run the protoc-3.11.0-osx-x86_64.exe for intel, but I haven't figure out yet if it is possible to override the arch in the plugin config. I will check that shortly.

I might also be able to specify the path to protoc outright, as I have protoc installed via brew elsewhere. Still, it would be nice to have a protoc-*-osx-aarch_64.exe available so that it works cross-platform.

I also have a brew installed protoc that seems to be compiled for arm, if you need it.

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

% ls -l /opt/homebrew/Cellar/protobuf/3.14.0/bin/protoc
-r-xr-xr-x  1 cmardini  staff  71872  4 Jan 16:22 /opt/homebrew/Cellar/protobuf/3.14.0/bin/protoc

% md5 /opt/homebrew/Cellar/protobuf/3.14.0/bin/protoc 
MD5 (/opt/homebrew/Cellar/protobuf/3.14.0/bin/protoc) = 0da061ae62c179f668ff4a544377cec3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions