我试图编译grpc Google Assistant SDK的新v1alpha2。
为此我在Google Assistant git存储库中运行make(使用cpp语言输出),生成了我的*.pb.cc
和*.ob.h
文件。然后我尝试将/google/api
,/google/type
*.pb.cc
文件编译成.o
文件,我可以链接到我的基本项目。 (embedded_assistant.proto
有两个进口声明:import "google/api/annotations.proto"; import "google/type/latlng.proto";
)。
我也尝试用/google/protobuf
和/google/rpc
编译它。
它由makefile
自动完成,在此命令中我收到以下错误:
make generated command:
g++ -c -I/usr/local/include -pthread -I./googleapis/gens -I./grpc -std=c++11 googleapis/gens/google/api/auth.pb.cc -o googleapis/gens/google/api/auth.pb.o
output:
googleapis/gens/google/api/auth.pb.cc:552:23: error: cannot cast '::google::protobuf::RepeatedPtrField< ::google::api::AuthenticationRule>' to its private base class
'google::protobuf::internal::RepeatedPtrFieldBase'
rules_.InternalSwap(&other->rules_);
^
/usr/local/include/google/protobuf/repeated_field.h:776:41: note: declared private here
class RepeatedPtrField PROTOBUF_FINAL : private internal::RepeatedPtrFieldBase {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
googleapis/gens/google/api/auth.pb.cc:553:27: error: cannot cast '::google::protobuf::RepeatedPtrField< ::google::api::AuthProvider>' to its private base class
'google::protobuf::internal::RepeatedPtrFieldBase'
providers_.InternalSwap(&other->providers_);
^
/usr/local/include/google/protobuf/repeated_field.h:776:41: note: declared private here
class RepeatedPtrField PROTOBUF_FINAL : private internal::RepeatedPtrFieldBase {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
googleapis/gens/google/api/auth.pb.cc:936:30: error: cannot cast '::google::protobuf::RepeatedPtrField< ::google::api::AuthRequirement>' to its private base class
'google::protobuf::internal::RepeatedPtrFieldBase'
requirements_.InternalSwap(&other->requirements_);
^
/usr/local/include/google/protobuf/repeated_field.h:776:41: note: declared private here
class RepeatedPtrField PROTOBUF_FINAL : private internal::RepeatedPtrFieldBase {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
make: *** [googleapis/gens/google/api/auth.pb.o] Error 1
感谢您的帮助,祝您度过愉快的假期
我设置了全新的东西,现在它可以工作了。我想也许有些包括路径是错误的。 (但我真的不知道,为什么现在有效)
https://github.com/googleapis/googleapis
googleapis
进入git submodule update --init
和checkout子模块make LANGUAGE=cpp
*.pb.cc
以及googleapis/gens/google/api
中的所有qazxsw poi文件googleapis/gens/google/type
和googleapis/gens/google/assistant/embedded/v1alpha2
,如步骤3中所示:grpc
我把这个脏的makefile放在一起。不是很好,但是诀窍。
protobuf