protoc-jar-maven-plugin icon indicating copy to clipboard operation
protoc-jar-maven-plugin copied to clipboard

Building on ARM platform

Open heychirag opened this issue 5 years ago • 8 comments

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?

heychirag avatar Aug 14 '20 20:08 heychirag

What's the issue?

os72 avatar Aug 14 '20 21:08 os72

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

Hisoka-X avatar Aug 15 '20 13:08 Hisoka-X

Thanks @BenJFan . That's right.

I also tried adding <protocArtifact> 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 "
)")

heychirag avatar Aug 15 '20 16:08 heychirag

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)

os72 avatar Aug 15 '20 22:08 os72

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?

heychirag avatar Aug 16 '20 22:08 heychirag

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

os72 avatar Aug 17 '20 23:08 os72

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

heychirag avatar Aug 18 '20 16:08 heychirag

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

os72 avatar Aug 18 '20 23:08 os72