ProtoBuf.jl icon indicating copy to clipboard operation
ProtoBuf.jl copied to clipboard

Error generating code for protos using well-known types

Open Octogonapus opened this issue 4 years ago • 0 comments
trafficstars

I have this proto file:

syntax = "proto3";

import "google/protobuf/timestamp.proto";

message TestMessage {
  google.protobuf.Timestamp a = 1;
}

Invoking protoc errors:

julia> run(ProtoBuf.protoc(`-I=proto -I=ProtoBuf/gen --julia_out=jlout proto/testproto.proto`))
ProtoBuf/gen: warning: directory does not exist.
google/protobuf/timestamp.proto: File not found.
testproto.proto:3:1: Import "google/protobuf/timestamp.proto" was not found or had errors.
testproto.proto:6:3: "google.protobuf.Timestamp" is not defined.

I guess there is some error with the relative path to ProtoBuf/gen since it is not found. I am using ProtoBuf v0.10.0 and Julia v1.5.2.

If I include the correct path to gen, it works:

run(ProtoBuf.protoc(`-I=proto -I=/home/salmon/.julia/packages/ProtoBuf/NJbMU/gen --julia_out=jlout proto/testproto.proto`))

For now, I will determine the path using joinpath(dirname(dirname(Base.pathof(ProtoBuf))), "gen").

Edit: Actually, if I install protobuf-devel, then protoc finds the well-known types automatically.

Octogonapus avatar Dec 10 '20 18:12 Octogonapus