gogo / grpc-example

An example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.
Other
454 stars 88 forks source link

make generate produces an error on centos #25

Closed kadisi closed 6 years ago

kadisi commented 6 years ago

when i exec make generate in my centos , it comes:

# Generate gogo, gRPC-Gateway, swagger, go-validators output.
#
# -I declares import folders, in order of importance
# This is how proto resolves the protofile imports.
# It will check for the protofile relative to each of these
# folders and use the first one it finds.
#
# --gogo_out generates GoGo Protobuf output with gRPC plugin enabled.
# --grpc-gateway_out generates gRPC-Gateway output.
# --swagger_out generates an OpenAPI 2.0 specification for our gRPC-Gateway endpoints.
# --govalidators_out generates Go validation files for our messages types, if specified.
#
# The lines starting with Mgoogle/... are proto import replacements,
# which cause the generated file to import the specified packages
# instead of the go_package's declared by the imported protof files.
#
# $GOPATH/src is the output directory. It is relative to the GOPATH/src directory
# since we've specified a go_package option relative to that directory.
#
# proto/example.proto is the location of the protofile we use.
protoc \
        -I proto \
        -I vendor/github.com/grpc-ecosystem/grpc-gateway/ \
        -I vendor/github.com/gogo/googleapis/ \
        -I vendor/ \
        --gogo_out=plugins=grpc,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\
$GOPATH/src/ \
        --grpc-gateway_out=\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\
$GOPATH/src/ \
        --swagger_out=third_party/OpenAPI/ \
        --govalidators_out=gogoimport=true,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\
$GOPATH/src \
        proto/example.proto
google/protobuf/empty.proto: File not found.
google/protobuf/timestamp.proto: File not found.
google/protobuf/duration.proto: File not found.
google/protobuf/field_mask.proto: File not found.
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.
google/protobuf/any.proto: File not found.
protoc-gen-swagger/options/openapiv2.proto: Import "google/protobuf/any.proto" was not found or had errors.
protoc-gen-swagger/options/openapiv2.proto:131:3: "google.protobuf.Any" is not defined.
protoc-gen-swagger/options/annotations.proto: Import "protoc-gen-swagger/options/openapiv2.proto" was not found or had errors.
protoc-gen-swagger/options/annotations.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
protoc-gen-swagger/options/annotations.proto:10:8: "google.protobuf.FileOptions" is not defined.
protoc-gen-swagger/options/annotations.proto:17:8: "google.protobuf.MethodOptions" is not defined.
protoc-gen-swagger/options/annotations.proto:24:8: "google.protobuf.MessageOptions" is not defined.
protoc-gen-swagger/options/annotations.proto:31:8: "google.protobuf.ServiceOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
github.com/gogo/protobuf/gogoproto/gogo.proto:38:8: "google.protobuf.EnumOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto:46:8: "google.protobuf.EnumValueOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto:50:8: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto:89:8: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto:123:8: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
github.com/mwitkow/go-proto-validators/validator.proto: Import "google/protobuf/descriptor.proto" was not found or had errors.
github.com/mwitkow/go-proto-validators/validator.proto:18:8: "google.protobuf.FieldOptions" is not defined.
example.proto: Import "google/protobuf/empty.proto" was not found or had errors.
example.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
example.proto: Import "google/protobuf/duration.proto" was not found or had errors.
example.proto: Import "google/protobuf/field_mask.proto" was not found or had errors.
example.proto: Import "google/api/annotations.proto" was not found or had errors.
example.proto: Import "protoc-gen-swagger/options/annotations.proto" was not found or had errors.
example.proto: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.
example.proto: Import "github.com/mwitkow/go-proto-validators/validator.proto" was not found or had errors.
example.proto:82:5: "google.protobuf.Timestamp" is not defined.
example.proto:97:5: "google.protobuf.FieldMask" is not defined.
example.proto:102:5: "google.protobuf.Timestamp" is not defined.
example.proto:106:5: "google.protobuf.Duration" is not defined.
example.proto:43:32: "google.protobuf.Empty" is not defined.
make: *** [generate] Error 1

and exec make install is ok

make install

go install \
        ./vendor/github.com/gogo/protobuf/protoc-gen-gogo \
        ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
        ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
        ./vendor/github.com/mwitkow/go-proto-validators/protoc-gen-govalidators \
        ./vendor/github.com/rakyll/statik

and when i exec make generate on my two mac, one is ok, but anther is failed.

kadisi commented 6 years ago

oh, my mistake, my protoc is in /usr/local/bin, but lack of /usr/local/include/google/protobuf/ dir

johanbrandhorst commented 6 years ago

These files should be included with a proper protoc installation, as I think you noticed. I will close this, please reopen if necessary.