c++ - MSYS2 MinGW 包中缺少 Protobuf grpc_cpp_plugin
问题描述
我安装了一个新的 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 虚拟机上运行,因此已验证该命令本身应该可以运行。
但是,当我尝试使用 protoc 生成文件时收到以下错误消息:
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"
推荐阅读
- android - 我可以使用智能手机生物识别传感器扫描公共指纹吗
- c++ - C++ - 在 Windows 上是否有任何命令喜欢 addr2line
- php - 使用 JQuery 在 fullcalendar 中保存事件不起作用
- sql - 在 SQL Developer 3.1.07 中为用户输入提供消息提示
- java - 如何从 Java 7 调用 Kotlin 挂起协程函数
- objective-c - 使用 SwiftyJSON 导出的 Swift 框架面临:由于未捕获的异常而终止应用程序
- c - 打印随机数而不是我的 var
- assembly - System V amd64 如何处理很长的返回值?
- javascript - LeafletJs - 无法设置未定义的属性“L”
- java - 我应该把connection.close()放在java中吗?