Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import "google/api/annotations.proto" was not found or had errors. #574

Closed
mossila opened this issue Mar 14, 2018 · 4 comments
Closed

Import "google/api/annotations.proto" was not found or had errors. #574

mossila opened this issue Mar 14, 2018 · 4 comments

Comments

@mossila
Copy link

mossila commented Mar 14, 2018

Env: Windows 10

after follow step on this link https://github.com/grpc-ecosystem/grpc-gateway

on this steps on windows

protoc -I/usr/local/include -I. \
  -I$GOPATH/src \
  -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
  --go_out=plugins=grpc:. \
  path/to/your_service.proto

That I update to

protoc -IC:\Users\mossila\AppData\Local\ -I. -I%GOPATH%\src -I%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --go_out=plugins=grpc:. test-grpc.proto

I got this error



google/protobuf/descriptor.proto: File not found.
google/api/annotations.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
google/api/annotations.proto:28:8: "google.protobuf.MethodOptions" is not defined.
test-grpc.proto: Import "google/api/annotations.proto" was not found or had errors.

Which I don't know how to continue.

@yugui
Copy link
Member

yugui commented Mar 26, 2018

It is expected that /usr/local/include contains google/protobuf/descriptor.proto in the documentation.
I'm sorry but the documentation does not cover all the possible cases for simplicity.

In your case, could you replace /usr/local/include with the corresponding include path in your installation of protobuf?
For example, if you have the protoc at C:\Users\mossila\AppData\Local\protoc-3.5.1-win32\bin\protoc, could you try replacing the path with C:\Users\mossila\AppData\Local\protoc-3.5.1-win32\include?

@mossila
Copy link
Author

mossila commented Mar 26, 2018

@yugui Ok, It's work.
I have install protoc-3.5.1 at C:\dev\bin\ and I try to create service.pb.go with this command

protoc -IC:\dev\bin\protoc-3.5.1\include -I. -I%GOPATH%\src -I%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --go_out=plugins=grpc:. .\my-proto\my-service.proto

Next I try to Generate reverse-proxy

 protoc -IC:\dev\bin\protoc-3.5.1\include -I. -I%GOPATH%\src -I%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --grpc-gateway_out=logtostderr=true:. \my-proto\my-service.proto

All things work!
Thanks.

@yugui
Copy link
Member

yugui commented Mar 26, 2018

Congratulations!

@yugui yugui closed this as completed Mar 26, 2018
ithinker1991 pushed a commit to tronprotocol/grpc-gateway that referenced this issue Jun 18, 2018
@cappuccino5
Copy link

thank your ,I too All things work!

@grpc-ecosystem grpc-ecosystem locked as resolved and limited conversation to collaborators Apr 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants