[Protocol Buffer/gRPC] protoc-gen-go-grpc: program not found or is not executable--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.

프로그래밍/Go lang2020. 11. 5. 18:08

proto파일에서 gRPC 서비스와 함수의 interface를 정의하고 난 후 아래의 명령어를 입력했습니다.

protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    my_service.proto

 

그러니까 아래의 에러가 발생했습니다.

protoc-gen-go: program not found or is not executable
--go_out: protoc-gen-go: Plugin failed with status code 1.
sudo apt install golang-goprotobuf-dev

위의 명령어를 사용해서 프로그램을 하나 설치했습니다.

 

그러니까 에러가 약간 달라졌습니다.

protoc-gen-go-grpc: program not found or is not executable 
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1. 

go get google.golang.org/grpc/cmd/protoc-gen-go-grpc

명령어로 프로그램을 설치하면 해결이 될 것 같은데 에러가 반복되네요.

 

home경로에 있는 .profile 파일의 PATH의 마지막에 go관련 경로를 추가했고 go나 protoc 명령어를 잘 동작합니다.

뭐가 문제일까요?

 

그런데 생각해보니..

grpc.io/docs/languages/go/quickstart/#regenerate-grpc-code에서

protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    helloworld/helloworld.proto

위의 코드를 정상적으로 실행한 적이 있습니다.

path문제일 것 같은 기분이 듭니다.

 

해결책은.. home 경로에 있는 .profile의 PATH에 아래 경로를 추가하면 됩니다.

 

/usr/local/go/bin

/home/bitnami/go/bin

 

 

protoc-gen-go와 protoc-gen-go-grpc는 /home/bitnami/go/bin 경로에 설치되어 있네요.

($go env GOPATH 명령어로 위치 확인 가능)

 

왜 경로가 이렇게 나뉘어 설치됐는지는 잘 모르겠습니다.

 

 

 

 

참고

.profile 수정 후에는 putty를 다시 시작해야 변경사항이 적용됨

 

작성자

Posted by 드리머즈

관련 글

댓글 영역