Protobuf: google/protobuf/timestamp.proto not found

Created on 9 Sep 2018  Â·  11Comments  Â·  Source: protocolbuffers/protobuf

I was going through the examples to installing protobuf and I am always getting

addressbook.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
addressbook.proto:44:3: "google.protobuf.timestamp" is not defined.

This always happens whenever i do a make go, a make python, and I'm sure its going to be the same with the other languages as well.

I checked my /usr/local/include/ and it has the right timestamp.proto package. I'm guessing I am missing something but through lots of googling i haven't seen an explicit answer. Can anyone guide me to the right spot?

protoc question

Most helpful comment

@amazingandyyy if you are doing this inside an alpine image, make sure you do apk add protobuf-dev before generating your files using protoc.

All 11 comments

How did you install protoc? Can you check if the protoc you are running is in /usr/local/bin?

which protoc

?

Also check the protoc version. You may have an older version of protoc preinstalled.

protoc --version

I installed by using the link https://github.com/protocolbuffers/protobuf/releases. I have 3.6.1 version installed. I am currently using the protoc in my goworkspace bin folder. Should it be using the /usr/local/bin?

@baqquan No, it doesn't have to be in /usr/local/bin, but the path where it's installed has to be included in the PATH. Example of a working setup:

$ which protoc
/opt/protobuf/bin/protoc

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/protobuf/bin:/Users/baer/go/bin

The included .proto files are then in /opt/protobuf/include/, so timestamp.proto is at /opt/protobuf/include/google/protobuf/timestamp.proto.

Lastly, it's included with: import "google/protobuf/timestamp.proto";

osx

$ which protoc
/Users/Macbook/go/bin/protoc

and then you put include under
/Users/Macbook/go/
other platform(windows,linux) are the same too.

any updates???

google/protobuf/timestamp.proto: File not found.
# protoc --version
libprotoc 3.1.0

I apologize for not getting to this sooner. This has been resolved. I had
brew installed which had its own instance of protoc and it was causing
conflicts.

On Thu, Apr 25, 2019 at 1:42 PM Andy Chen notifications@github.com wrote:

any updates???

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/protocolbuffers/protobuf/issues/5131#issuecomment-486829859,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB56GFPHLBVQBQDQ6BI64VDPSIJUHANCNFSM4FUAPOCQ
.

@amazingandyyy if you are doing this inside an alpine image, make sure you do apk add protobuf-dev before generating your files using protoc.

@chaitan94 ok and may I ask what are they different? thanks

@amazingandyyy do you mean what's the difference between protobuf and protobuf-dev? If so, it's as simple as the fact that the original package has the bare minimum files needed for protoc to function. This also includes the file relevant to this issue, /usr/include/google/protobuf/timestamp.proto.

For more datails check out the pages on alpinelinux.org for protobuf and protobuf-dev

Close for now as correct answer has been provided :)

Was this page helpful?
0 / 5 - 0 ratings