我安装了一个全新的MSYS2环境,并下载了带有依赖项的mingw-w64-x86_64-grpc
包(mingw-w64-protobuf
就是其中之一),除了grpc_cpp_plugin部分之外,我可以运行protobuf命令。makefile中使用的命令有:
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
gen:
my_file.proto --proto_path="../proto/" --cpp_out="../cxx/gen/" --grpc_out="../cxx/gen"
完全相同的命令在Debian虚拟机中工作,因此可以验证命令本身是否可以工作。
然而,当我试图用协议生成文件时,我收到了以下错误消息:
grpc_cpp_plugin: program not found or is not executable.
我查看了mingw64 bin文件夹,确实存在protoc可执行文件,但缺少grpc_cpp_plugin。
我试图从源代码构建grpc,但无法实现,所以也许我认为有一个包可以安装到MSYS环境中。
我在另一个答案中找到了一些可执行文件,并复制了它们,但(我确信是因为版本或体系结构不匹配)这些文件无法使用。
我错过了什么?在哪里可以获得grpc_cpp_plugin可执行文件?
这是Windows/MinGW下的扩展解析问题。在对makefile进行以下更改后,协议缓冲区成功生成:
GRPC_CPP_PLUGIN = grpc_cpp_plugin.exe # . exe was added so the plugin executable would be found
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
gen:
my_file.proto --proto_path="../proto/" --cpp_out="../cxx/gen/" --grpc_out="../cxx/gen"