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

1

8

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

Mercantile answered 6/3, 2019 at 12:44 Comment(0)
M
10

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)

Mercantile answered 6/3, 2019 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.