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 #422

Closed
jwalters-gpsw opened this issue Jun 26, 2017 · 14 comments
Closed

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

jwalters-gpsw opened this issue Jun 26, 2017 · 14 comments

Comments

@jwalters-gpsw
Copy link

When trying to compile the proto file for https://github.com/philips/grpc-gateway-example/tree/master/echopb

get the error: google/protobuf/descriptor.proto: File not found

Either don't have the right descriptor.proto installed, or something about protoc args need to be changed. Any ideas?

Both
./github.com/googleapis/googleapis/third_party/nanopb/generator/proto/google/protobuf/descriptor.proto
and
./github.com/googleapis/googleapis/third_party/protobuf/src/google/protobuf/descriptor.proto

are in my $GOPATH/src

Golang: 1.8.3
OS: darwin

Makefile:

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

$ make
protoc -I/usr/local/include -I. \
		-I/Users/jwalters/go/src \
		-I/Users/jwalters/go/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
		--go_out=google/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \
		service.proto
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.
service.proto: Import "google/api/annotations.proto" was not found or had errors.
make: *** [all] Error 1

@AlekSi
Copy link
Contributor

AlekSi commented Jul 14, 2017

That's the problem with include directories. Do you have /usr/local/include/google/protobuf directory? Did you run protobuf's make install?

@upeediak
Copy link

As AlekSi mentioned, it is missing includes. If you downloaded and extracted the protoc-xyz-os-....zip file, there should be an include folder. Make sure you move the content of that folder to somewhere under your PATH (eg: /usr/local/include/)

@achew22
Copy link
Collaborator

achew22 commented Dec 14, 2017

If you continue having issues please reopen or file a new issue.

@achew22 achew22 closed this as completed Dec 14, 2017
@lei314121077
Copy link

lei314121077 commented Aug 2, 2018

I also encountered the same problem!
Does anyone know how to solve it?

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. threeapipb.proto: Import "google/api/annotations.proto" was not found or had errors.
your need install protobuf 3 on your system

Make sure you grab the latest version

curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip

Unzip

unzip protoc-3.2.0-linux-x86_64.zip -d protoc3

Move protoc to /usr/local/bin/

sudo mv protoc3/bin/* /usr/local/bin/

Move protoc3/include to /usr/local/include/

sudo mv protoc3/include/* /usr/local/include/

Optional: change owner

sudo chown [user] /usr/local/bin/protoc
sudo chown -R [user] /usr/local/include/google
``

@oseiskar
Copy link

oseiskar commented Jan 7, 2019

Encountered this issue and solved it on Debian Stretch Linux by installing libprotobuf-dev and libprotoc-dev packages (not sure which one was needed or both).

This was in a different context not related to grpc-gateway but googling the error brought me and hence this seems like the best forum for sharing this solution.

@rafee
Copy link

rafee commented Oct 24, 2019

Encountered this issue and solved it on Debian Stretch Linux by installing libprotobuf-dev and libprotoc-dev packages (not sure which one was needed or both).

This was in a different context not related to grpc-gateway but googling the error brought me and hence this seems like the best forum for sharing this solution.

This solved my issue by installing libprotobuf-dev

@lookbackagain
Copy link

lookbackagain commented Dec 9, 2019

At window10, '/usr/local/include/' shoud replace with what your download protobuf path

@raymond-liao
Copy link

Does any one meet the same error on macOS? I've installed protobuf via brew install protobuf already.

➜  ~ brew info protobuf                                 
protobuf: stable 3.11.0 (bottled), HEAD
Protocol buffers (Google's data interchange format)
https://github.com/protocolbuffers/protobuf/
/usr/local/Cellar/protobuf/3.6.1 (256 files, 17.2MB) *
  Poured from bottle on 2018-11-03 at 19:07:25
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/protobuf.rb
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔, python ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 41,926 (30 days), 140,726 (90 days), 455,949 (365 days)
install-on-request: 18,303 (30 days), 61,550 (90 days), 207,336 (365 days)
build-error: 0 (30 days)

@raymond-liao
Copy link

Still get this error after upgrade protobuf.

➜  ~ brew info protobuf   
protobuf: stable 3.11.0 (bottled), HEAD
Protocol buffers (Google's data interchange format)
https://github.com/protocolbuffers/protobuf/
/usr/local/Cellar/protobuf/3.11.0 (268 files, 19.5MB) *
  Poured from bottle on 2020-01-14 at 11:59:20
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/protobuf.rb
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔, python ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 41,926 (30 days), 140,726 (90 days), 455,949 (365 days)
install-on-request: 18,303 (30 days), 61,550 (90 days), 207,336 (365 days)
build-error: 0 (30 days)

@johanbrandhorst
Copy link
Collaborator

Hi, this isn't an issue with the gRPC-gateway, so please try to find help elsewhere. The error implies that you have an incorrect protobuf installation. Perhaps raise the issue with the package maintainers?

@chengyayu
Copy link

chengyayu commented Jun 23, 2020

Does any one meet the same error on macOS? I've installed protobuf via brew install protobuf already.

➜  ~ brew info protobuf                                 
protobuf: stable 3.11.0 (bottled), HEAD
Protocol buffers (Google's data interchange format)
https://github.com/protocolbuffers/protobuf/
/usr/local/Cellar/protobuf/3.6.1 (256 files, 17.2MB) *
  Poured from bottle on 2018-11-03 at 19:07:25
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/protobuf.rb
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔, python ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 41,926 (30 days), 140,726 (90 days), 455,949 (365 days)
install-on-request: 18,303 (30 days), 61,550 (90 days), 207,336 (365 days)
build-error: 0 (30 days)

Has the problem been solved? I encountered the same problem.

@kuchaguangjie
Copy link

In addition to copy protoc/include/google into /usr/local/include/.

For Goland (or other Jetbrains IDE), need do following:

  • preference -> language & framework -> protocol buffers,
  • uncheck "configure automatically",
  • add import path as /usr/local/include.

@shivshankarramprasad
Copy link

usr/local/include location ? where in C://

@neo502721
Copy link

Encountered this issue and solved it on Debian Stretch Linux by installing libprotobuf-dev and libprotoc-dev packages (not sure which one was needed or both).

This was in a different context not related to grpc-gateway but googling the error brought me and hence this seems like the best forum for sharing this solution.

apt install libprotoc-dev worked on ubuntu 20.04.5

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