On Wed, Apr 14, 2010 at 2:01 PM, CB <[email protected]> wrote: > I understand your explanation, and have changed my automake to; > > $(PROTOC) --cpp_out=$(top_srcdir) -I$(top_srcdir) $(PROTOC_FLAGS) $< > > which seems to handle it. > > However, there is still one point we're not connecting on, which is > this. It seems that when a.proto compiles, the name for > 'protobuf_AddDesc_foo_2eproto' is derived from the canonical name for > a.proto, but when b.proto compiles, the name of that function is > derived not from the canonical name for a.proto, but from the import > statement in b.proto - because protoc assumes the two will be the same > thing. >
Yes, import statements must use canonical names. > In a Java world, the assumption that these two things will be the same > holds because the javac enforces it with strict package name and > folder name checking relative to the CLASSPATH. protoc doesn't do > this, and so it shouldn't make the same assumptions. How is protoc's --proto_path (-I) any different from javac's CLASSPATH? I don't see the difference. > When compiling > b.proto, it should use the canonical name for a.proto to cook the > method name. If you search the -I paths, and find two a.proto files, > then by all means, flag an error and exit. > When compiling b.proto, protoc sees an import for "P/a.proto". It searches for this file and finds it with no problems. protoc has *no reason* to believe that this file's canonical name is anything other than "P/a.proto". There are not "two a.proto files" -- there is "a.proto" and "P/a.proto", and protoc has no reason to ever look at the former. Sorry, there is nothing protoc can do to detect your problem, except perhaps to notice that your two import paths overlap. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
