pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.62k stars 462 forks source link

ERROR : protoc-gen-doc: program not found or is not executable during execution #378

Closed kkdeepakkrish closed 5 years ago

kkdeepakkrish commented 5 years ago

Hi @pseudomuto, I am experiencing the below error while trying to use the protoc-gen-doc plugin in my own dockerized CentOS container. [root@203ba962febd repo]# ./protoc --plugin=protoc-gen-doc=/var/repo/protoc-gen-doc --doc_out=./grpc_doc --doc_opt=html,index.html service/*.proto ./protoc-gen-doc: program not found or is not executable --doc_out: protoc-gen-doc: Plugin failed with status code 1.

Both protoc and protoc-gen-doc binaries are present in the working directory

I have the following simple usecase: My objective is to have the protoc-gen-doc binary which has been compiled and installed on my local machine ported over for usage in a docker container.

  1. Using go, compile and install protoc-gen-doc go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc

  2. Copy over the binary from the GOPATH/bin location into my directory used for creating container cp $GOPATH/bin/protoc-gen-doc /

  3. Create docker image and run the container to test the binary which is copied over

  4. The dir structure of my working directory inside the container looks like belo rwxr-xr-x 1 root root 4.4M Dec 14 21:52 protoc -rwxr-xr-x 1 root root 7.4M Dec 14 21:50 protoc-gen-doc drwxr-xr-x 2 root root 4.0K Dec 14 19:09 service/

service/ dir contains the .proto files

  1. Next I run the protoc command as above providing the plugin path, but end up with the error shown [root@203ba962febd repo]# ./protoc --plugin=protoc-gen-doc=/var/repo/protoc-gen-doc --doc_out=./grpc_doc --doc_opt=html,index.html service/*.proto ./protoc-gen-doc: program not found or is not executable --doc_out: protoc-gen-doc: Plugin failed with status code 1.

NOTES/FYI:

  1. The plugin works perfectly well on my local machine
  2. The plugin works if I install the binary using : go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc INSIDE the container
  3. The problem is seen only when I am copying over the binary from my local to the container.

Can you help understand this behavior? Is there a reason why the I can't simply port the binary plugin? I am not too familiar with go.

I did see that a similar issue was reported here https://github.com/pseudomuto/protoc-gen-doc/issues/345 but the resolution provided has not helped me.

Greatly appreciate any help regarding this.

Thanks!

Deepak

kkdeepakkrish commented 5 years ago

Closing the issue . I had failed to cross-compile the binary which was required for portability. https://golang.org/doc/install/source#environment