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

google/protobuf/descriptor.proto: File not found. #194

Closed
brianstarke opened this issue Jul 14, 2016 · 9 comments
Closed

google/protobuf/descriptor.proto: File not found. #194

brianstarke opened this issue Jul 14, 2016 · 9 comments

Comments

@brianstarke
Copy link

I have a project using grpc-gateway that was building correctly fairly recently, however when I set everything up from scratch on a new laptop I'm unable to build due the following 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:26:8: "google.protobuf.MethodOptions" is not defined.
proto/lead.proto: Import "google/api/annotations.proto" was not found or had errors.

I'm on OSX, and set up everything as such:

wget https://github.com/google/protobuf/releases/download/v3.0.0-beta-3/protoc-3.0.0-beta-3-osx-x86_64.zip

mkdir temp
unzip -d temp protoc-3.0.0-beta-3-osx-x86_64.zip
mv temp/protoc /usr/local/bin

rm -rf temp
rm protoc-3.0.0-beta-3-osx-x86_64.zip

go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}

And I've been attempting to generate as follows:

protoc -I/usr/local/include -I. \
 -I$GOPATH/src \
 -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
 --go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
 proto/*.proto

The .proto:

syntax = "proto3";
package prequal;

import "google/api/annotations.proto";

service PrequalSvc {
  rpc Prequal(PrequalRequest) returns (PrequalResponse) {
    option (google.api.http) = {
      post: "/api/v1/prequal"
      body: "*"
    };
  }
}

Did I miss something in the setup?

@brianstarke
Copy link
Author

brianstarke commented Jul 14, 2016

PEBKAC, I'm an idiot.

If you just copy protoc without anything else in to /usr/local/bin, you're going to be missing a lot of stuff/have a bad time.

@dmlyons
Copy link

dmlyons commented Mar 14, 2017

um, what else should I have copied, and where to?

@tmc
Copy link
Collaborator

tmc commented Mar 14, 2017

@dmlyons I think the important thing is that the directory containing protoc should be on your PATH. @brianstarke can you confirm for posterity?

@brianstarke
Copy link
Author

Yes, it was some time ago - but I believe that was the fix - my current rc has

export PATH="/usr/local/opt/[email protected]/bin:$PATH"

And I've been building fine for months.

@gnomeria
Copy link

gnomeria commented Apr 3, 2017

I have the same problem, could you please elaborate on your fix? I have used the --go_path to my workspace on customized go installation location.

@nwochaadim
Copy link

@brianstarke you are a live saver. I thought I had grown past issues like this.

@danforbes
Copy link

I believe that the solution refereneced here is to install from source, as described here.

@jackielii
Copy link

~/Downloads/protoc $ sudo cp -r bin include /usr/local/

@imranrazakhan
Copy link

On CentOS7 i installed protobuf-devel-3.6.1-4.el7.x86_64.rpm and it resolved my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants