Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

--grpc_out: protoc-gen-grpc: Plugin failed with status code 1 on osx. (Java)

I am following a tutorial about using grpc and I am supposed to use a plugin to generate source code but I am stuck on how to use the --grpc_out and --plugin flag.

Below are the current challenges.

  1. The protocol generator downloaded from https://search.maven.org/ as in the tutorial is an executable file for osx operating system https://search.maven.org/search?q=a:protoc-gen-grpc-java. This is the first confusion. enter image description here
  2. If I dont use these plugin flags (--plugin,--grpc_out) my code is generated okay with this command

    protoc -I /proto --java_out /hello/grpc/grpc/revamp/services /proto/messages.proto

    This above works okay

  3. Adding the flags, with the downloaded plugin from confusion 1 throws this error with this command;

    protoc -I /proto --java_out /hello/grpc/grpc/revamp/services /proto/messages.proto --grpc_out /hello/grpc/grpc/revamp/services --plugin=protoc-gen-grpc=/proto/lib/protoc-gen-grpc-java-1.19.0-osx-x86_64.exe

    --grpc_out: protoc-gen-grpc: Plugin failed with status code 1.

Has anyone used this plugin on osx?, can anyone help see what I am doing wrong.

Thanks in advance

like image 726
IsaacK Avatar asked Mar 06 '19 12:03

IsaacK


1 Answers

To resolve this, first I removed the .exe extension from the file downloaded from maven,

then allow the file to be executable by running the following command

chmod +x protoc-gen-grpc-java

After this the query worked okay. (Special thanks from the @author of the Course Michael Van Sickle)

like image 126
IsaacK Avatar answered Nov 06 '22 01:11

IsaacK