Grpc-gateway: google/protobuf/descriptor.proto: File not found

Created on 26 Jun 2017  ·  11Comments  ·  Source: grpc-ecosystem/grpc-gateway

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

Most helpful comment

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
``

All 11 comments

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

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/)

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

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
``

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.

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

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

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)

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)

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?

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tamalsaha picture tamalsaha  ·  3Comments

mwitkow picture mwitkow  ·  3Comments

fifthaxe picture fifthaxe  ·  5Comments

stevenroose picture stevenroose  ·  3Comments

trelore picture trelore  ·  4Comments