Skip to content

jsonpb/jsonpb_test_proto/test_objects.proto does not regenerate #149

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

Closed
awalterschulze opened this issue Mar 17, 2016 · 14 comments
Closed

Comments

@awalterschulze
Copy link

This is with commit 553c764

jsonpb_test_proto$ make
protoc --go_out=Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp:. *.proto
google/protobuf/duration.proto: File not found.
google/protobuf/timestamp.proto: File not found.
test_objects.proto: Import "google/protobuf/duration.proto" was not found or had errors.
test_objects.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
test_objects.proto:116:12: "google.protobuf.Duration" is not defined.
test_objects.proto:117:12: "google.protobuf.Timestamp" is not defined.

The same is happening on master.

@awalterschulze
Copy link
Author

Sorry to be a bother, but I just wanted to remind you of this issue.
It is kind of a blocking issue for me, before I can merge in the newest golang/protobuf code containing well known types and your go_package change.

@dsymonds
Copy link
Contributor

Curious. Running make in that directory works for me.

What does protoc --version say for you? Mine says libprotoc 3.0.0. Note that we need 3.0.0 to support these WKTs. That might be the problem.

@awalterschulze
Copy link
Author

I have protoc version 3 beta 2

$ protoc --version
libprotoc 3.0.0

On golang/protobuf tip

$ make
protoc --go_out=Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. *.proto
google/protobuf/duration.proto: File not found.
google/protobuf/struct.proto: File not found.
google/protobuf/timestamp.proto: File not found.
google/protobuf/wrappers.proto: File not found.
test_objects.proto: Import "google/protobuf/duration.proto" was not found or had errors.
test_objects.proto: Import "google/protobuf/struct.proto" was not found or had errors.
test_objects.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
test_objects.proto: Import "google/protobuf/wrappers.proto" was not found or had errors.
test_objects.proto:119:12: "google.protobuf.Duration" is not defined.
test_objects.proto:120:12: "google.protobuf.Struct" is not defined.
test_objects.proto:121:12: "google.protobuf.Timestamp" is not defined.
test_objects.proto:123:12: "google.protobuf.DoubleValue" is not defined.
test_objects.proto:124:12: "google.protobuf.FloatValue" is not defined.
test_objects.proto:125:12: "google.protobuf.Int64Value" is not defined.
test_objects.proto:126:12: "google.protobuf.UInt64Value" is not defined.
test_objects.proto:127:12: "google.protobuf.Int32Value" is not defined.
test_objects.proto:128:12: "google.protobuf.UInt32Value" is not defined.
test_objects.proto:129:12: "google.protobuf.BoolValue" is not defined.
test_objects.proto:130:12: "google.protobuf.StringValue" is not defined.
test_objects.proto:131:12: "google.protobuf.BytesValue" is not defined.
make: *** [regenerate] Error 1

@awalterschulze
Copy link
Author

I have never used M before, but I would usually solve this problem by creating a google/protobuf folder, placing the proto files in there and then setting the appropriate proto_path

@awalterschulze
Copy link
Author

I am on osx 10.10.5 with go1.6

@awalterschulze
Copy link
Author

any ideas?

@dsymonds
Copy link
Contributor

There's still got to be something different between our environments. I can't fix anything without being able to reproduce the problem you're seeing.

Somehow my protoc is finding google/protobuf/duration.proto and friends without issue. Did you install protoc from source? That might be it, if those .proto files aren't included in binary distributions.

@awalterschulze
Copy link
Author

I don't install from source it I can just install the osx version. I am lazy like that.

I don't think this has anything to do with the fact that the proto files are compiled into protoc.
I mean the proto files are in the github.com/golang/protobuf/ptypes/duration, etc. folder.
I think the protopath should also point to the src folder, so that protoc can find them at.
src/github.com/golang/protobuf/ptypes/duration

@awalterschulze
Copy link
Author

Ok but this also does not work

protoc --go_out=Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,Mgoogle/protobuf/struct.proto=github.com/golang/protobuf/ptypes/struct,Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers:. --proto_path=../../../../../:. *.proto

@dsymonds
Copy link
Contributor

Ah, if you don't have the source install then that'd be the problem. The "google/protobuf/duration.proto" is the official path for it, but it's a known problem for us that we don't have a global filesystem for everyone, and at least on my system the way that import is resolved is by looking at where the protoc sources are found. We don't want to make "github.com/golang/protobuf/ptypes/duration/duration.proto" be the official way that that .proto gets imported either.

I think for now you'll need a proto source installation (you don't have to build it or anything, just have it unzipped somewhere) and point -I (or --proto_path) at its src directory.

@awalterschulze
Copy link
Author

But this works

protoc --go_out=. --proto_path=../../:. *.proto

If I change the imports to

import "ptypes/duration/duration.proto";
import "ptypes/struct/struct.proto";
import "ptypes/timestamp/timestamp.proto";
import "ptypes/wrappers/wrappers.proto";

@awalterschulze
Copy link
Author

Why not just make a google/protobuf folder with all the .proto files and then you can have

protoc --go_out=. --proto_path=../../protobuf/:. *.proto

And you can keep all your import paths.

@awalterschulze
Copy link
Author

I mean this is going to be a problem for a lot of people?

@dsymonds
Copy link
Contributor

This is just #143 then.

@golang golang locked as resolved and limited conversation to collaborators Jun 25, 2020
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

2 participants