os72 / protoc-jar-maven-plugin

Protocol Buffers protobuf maven plugin - based on protoc-jar multi-platform executable protoc JAR
http://os72.github.io/protoc-jar-maven-plugin/
Apache License 2.0
249 stars 79 forks source link

Building on ARM platform #92

Open heychirag opened 4 years ago

heychirag commented 4 years ago

Hi, I am having trouble building a project that uses protoc-jar-maven-plugin on a raspberrypi. Is there a guide on how to build this plugin on an ARM device?

os72 commented 4 years ago

What's the issue?

Hisoka-X commented 4 years ago

when build flink-python 1.10.1: Failed to execute goal com.github.os72:protoc-jar-maven-plugin:3.7.1:run (default) on project flink-python_2.12: Error extracting protoc for version 3.7.1: Unsupported platform: protoc-3.7.1-linux-aarch_64.exe

heychirag commented 4 years ago

Thanks @BenJFan . That's right.

I also tried adding and linking protoc to the right aarch_64 file:

<protocArtifact>com.google.protobuf:protoc:3.9.2:exe:linux-aarch_64</protocArtifact>

But now I get this error:

[INFO]     Processing (java): OpenApiModelMessages.proto
protoc-jar: executing: [/tmp/protoc1980677954583734614.exe, -I/home/pi/openapi2-client/src/m
ain/protobuf, -I/home/pi/openapi2-client/src/main/protobuf, --java_out=/home/pi/openapi2-client/target/generated-sources, /home/pi/openapi2-client/src/main/pro
tobuf/OpenApiModelMessages.proto]
/tmp/protoc1980677954583734614.exe: 1: /tmp/protoc1980677954583734614.exe: Syntax error: word unexpected (expecting "
)")
os72 commented 4 years ago

It should work. Does the machine have access to maven central? (the plugin attempts to download) You could also try a newer version.

What does the cmd line say? java -jar protoc-jar-maven-plugin-3.7.1.jar --version

<protocArtifact> forces the download option, the syntax is simply (see documentation):

<protocArtifact>com.google.protobuf:protoc:3.7.1</protocArtifact>

BTW the syntax error seems to be coming from protoc itself

(Please consider sponsoring/donating if you find the project useful)

heychirag commented 4 years ago

For the first one, I get following output:

Error: Unable to access jarfile protoc-jar-maven-plugin-3.7.1.jar

For your second suggestion, if I don't write it the way I do, then I get following error:

: Error resolving artifact: com.google.protobuf:protoc:3.9.2: Could not find artifact com.google.protobuf:protoc:exe:
linux-arm_32:3.9.2 in central (https://repo.maven.apache.org/maven2)

It is trying to find for linux-arm_32 instead of linux-aarch_64 which is not available (Check Here). Does this simply mean that this plugin could never work for Raspberrypi?

os72 commented 4 years ago

Re the cmd line, you need to point to the actual JAR file location

The plugin is working, the trouble seems to be the platform, seems to be 32 bit ARM? Google doesn't provide protoc for that, and no one contributed to my repo of protoc binaries either

Are you able to run linux-aarch_64 protoc successfully on the machine? If yes, your linux-aarch_64 protocArtifact spec should work

heychirag commented 4 years ago

No linux-aarch_64 protoc is throwing the following error.

[INFO]     Processing (java): OpenApiModelMessages.proto
protoc-jar: executing: [/tmp/protoc1980677954583734614.exe, -I/home/pi/openapi2-client/src/m
ain/protobuf, -I/home/pi/openapi2-client/src/main/protobuf, --java_out=/home/pi/openapi2-client/target/generated-sources, /home/pi/openapi2-client/src/main/pro
tobuf/OpenApiModelMessages.proto]
/tmp/protoc1980677954583734614.exe: 1: /tmp/protoc1980677954583734614.exe: Syntax error: word unexpected (expecting "
)")

I think I would never be able to make this work unless Google releases one for linux-arm_32

os72 commented 4 years ago

I wonder if that error is actually emitted by protoc itself. You should try downloading and running protoc --version manually