Cygwin Windows中的Protoc错误

Cygwin Windows中的Protoc错误,cygwin,protocol-buffers,protoc,Cygwin,Protocol Buffers,Protoc,我正在尝试使用和我在Cygwin中构建的protoc可执行文件编译协议缓冲区代码。我无法从Cygwin或Windows命令行执行此操作。下面是我在Windows中运行它时得到的输出,但在Cygwin中运行时错误是相同的。我觉得这很奇怪,因为如果问题是路径转换,那么我希望其中一个可以工作。可执行文件是用Cygwin的g++构建的,这一事实是否可能会影响某些事情?(显而易见,该目录确实存在。) 编辑:当我把maven从图片中拿出来,然后手动调用protoc时,我会遇到同样的错误 编辑2:我可以通过使

我正在尝试使用和我在Cygwin中构建的protoc可执行文件编译协议缓冲区代码。我无法从Cygwin或Windows命令行执行此操作。下面是我在Windows中运行它时得到的输出,但在Cygwin中运行时错误是相同的。我觉得这很奇怪,因为如果问题是路径转换,那么我希望其中一个可以工作。可执行文件是用Cygwin的g++构建的,这一事实是否可能会影响某些事情?(显而易见,该目录确实存在。)

编辑:当我把maven从图片中拿出来,然后手动调用protoc时,我会遇到同样的错误

编辑2:我可以通过使用相对或绝对路径从Cygwin手动调用protoc来解决这个问题(但是tilde扩展不起作用)。使用相对或绝对路径从Windows手动调用protoc仍然会产生相同的错误

[DEBUG] (f) outputDirectory = c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java [DEBUG] (f) project = MavenProject: server:protocol:1.0-SNAPSHOT @ c:\cygwin64\home\dan\code\server\protocol\pom.xml [DEBUG] (f) protoSourceRoot = c:\cygwin64\home\dan\code\server\protocol\src\main\proto [DEBUG] (f) protocPluginDirectory = c:\cygwin64\home\dan\code\server\protocol\target\protoc-plugins [DEBUG] (f) remoteRepositories = [ id: central url: https://repo.maven.apache.org/maven2 layout: default snapshots: [enabled => false, update => daily] releases: [enabled => true, update => daily] ] [DEBUG] (f) session = org.apache.maven.execution.MavenSession@24fb6a80 [DEBUG] (f) skip = false [DEBUG] (f) staleMillis = 0 [DEBUG] (f) temporaryProtoFileDirectory = c:\cygwin64\home\dan\code\server\protocol\target\protoc-dependencies [DEBUG] (f) writeDescriptorSet = false [DEBUG] -- end configuration -- [WARNING] No 'protocExecutable' parameter is configured, using the default: 'protoc' [DEBUG] Proto source root: [DEBUG] c:\cygwin64\home\dan\code\server\protocol\src\main\proto [DEBUG] [PROTOC] Executable: [DEBUG] [PROTOC] protoc [DEBUG] [PROTOC] Protobuf import paths: [DEBUG] [PROTOC] c:\cygwin64\home\dan\code\server\protocol\src\main\proto [DEBUG] [PROTOC] Java output directory: [DEBUG] [PROTOC] c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java [DEBUG] [PROTOC] Protobuf descriptors: [DEBUG] [PROTOC] c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto [DEBUG] [PROTOC] Command line options: [DEBUG] [PROTOC] --proto_path=c:\cygwin64\home\dan\code\server\protocol\src\main\proto --java_out=c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto [INFO] Compiling 1 proto file(s) to c:\cygwin64\home\dan\code\server\protocol\target\generated-sources\protobuf\java [ERROR] PROTOC FAILED: c: warning: directory does not exist. c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think). [DEBUG](f)outputDirectory=c:\cygwin64\home\dan\code\server\protocol\target\generated sources\protobuf\java [DEBUG](f)project=MavenProject:server:protocol:1.0-SNAPSHOT@c:\cygwin64\home\dan\code\server\protocol\pom.xml [DEBUG](f)protoSourceRoot=c:\cygwin64\home\dan\code\server\protocol\src\main\proto [DEBUG](f)protocPluginDirectory=c:\cygwin64\home\dan\code\server\protocol\target\protoc插件 [调试](f)远程存储库=[ id:中环 网址:https://repo.maven.apache.org/maven2 布局:默认快照:[已启用=>false,更新=>daily] 发布:[已启用=>true,更新=>daily] ] [DEBUG](f)session=org.apache.maven.execution。MavenSession@24fb6a80 [DEBUG](f)skip=false [DEBUG](f)staleMillis=0 [DEBUG](f)temporaryProtoFileDirectory=c:\cygwin64\home\dan\code\server\protocol\target\protoc依赖项 [DEBUG](f)writeDescriptorSet=false [调试]--结束配置-- [警告]未配置“ProtoceExecutable”参数,使用默认值:“protoc” [调试]原始源根目录: [调试]c:\cygwin64\home\dan\code\server\protocol\src\main\proto [调试][协议]可执行文件: [调试][协议]协议 [DEBUG][PROTOC]Protobuf导入路径: [DEBUG][PROTOC]c:\cygwin64\home\dan\code\server\protocol\src\main\proto[DEBUG][PROTOC]Java输出目录: [DEBUG][PROTOC]c:\cygwin64\home\dan\code\server\protocol\target\generated sources\protobuf\java [DEBUG][PROTOC]Protobuf描述符: [DEBUG][PROTOC]c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto [DEBUG][PROTOC]命令行选项: [调试][协议] --proto\u path=c:\cygwin64\home\dan\code\server\protocol\src\main\proto --java\u out=c:\cygwin64\home\dan\code\server\protocol\target\generated sources\protobuf\java c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto [信息]正在将1个协议文件编译为c:\cygwin64\home\dan\code\server\protocol\target\generated sources\protobuf\java [错误]协议失败:c:警告:目录不存在。c:\cygwin64\home\dan\code\server\protocol\src\main\proto\message.proto:文件不在使用--proto\u path(或-I)指定的任何路径中。必须指定包含此文件的--proto_路径。请注意,proto_路径必须是.proto文件名的精确前缀——protoc太笨了,无法确定两个路径(例如绝对路径和相对路径)何时相等(这比您想象的要困难)。
使用Cygwin构建的可执行文件将取决于完整的Cygwin环境,并将作为Cygwin程序运行,而不管您如何执行它们。也就是说,如果从非Cygwin shell执行Cygwin程序,它仍将作为Cygwin程序运行。Cygwin程序不接受使用反斜杠和驱动器号的Windows样式路径;您需要使用例如
/cygdrive/c/
而不是
c:\

通常,您不应该尝试从非Cygwin shell使用Cygwin编译的命令行工具。相反,尝试使用MSVC或MinGW构建
protoc
,或者使用谷歌提供的预构建Windows二进制文件