Windows中的Protoc错误

我试图使用maven protoc插件和我在Cygwin内部构建的protoc可执行文件编译协议缓冲区代码。 我无法从Cygwin或Windows命令行执行此操作。 下面是我在Windows中运行它时得到的输出,但从Cygwin运行时错误是相同的。 我觉得这很奇怪,因为如果问题是路径翻译,那么我希望其中一个工作。 可执行文件是用Cygwin的g ++编译的事实可能会影响事物吗? (为了说明这个问题,有问题的目录确实存在。)

编辑:当我从图片中取出maven并且手动调用protoc时,我得到了同样的错误。

编辑2:我可以通过使用相对或绝对路径从Cygwin手动调用protoc来解决此问题(但代字符扩展不起作用)。 从Windows使用相对或绝对路径手动调用protoc继续给出相同的错误。

[DEBUG]   (f) outputDirectory = c:cygwin64homedancodeserverprotocoltargetgenerated-sourcesprotobufjava
[DEBUG]   (f) project = MavenProject: server:protocol:1.0-SNAPSHOT @ c:cygwin64homedancodeserverprotocolpom.xml
[DEBUG]   (f) protoSourceRoot = c:cygwin64homedancodeserverprotocolsrcmainproto
[DEBUG]   (f) protocPluginDirectory = c:cygwin64homedancodeserverprotocoltargetprotoc-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:cygwin64homedancodeserverprotocoltargetprotoc-dependencies
[DEBUG]   (f) writeDescriptorSet = false
[DEBUG] -- end configuration --
[WARNING] No 'protocExecutable' parameter is configured, using the default: 'protoc'
[DEBUG] Proto source root:
[DEBUG]  c:cygwin64homedancodeserverprotocolsrcmainproto
[DEBUG] [PROTOC] Executable:
[DEBUG] [PROTOC]  protoc
[DEBUG] [PROTOC] Protobuf import paths:
[DEBUG] [PROTOC]  c:cygwin64homedancodeserverprotocolsrcmainproto [DEBUG] [PROTOC] Java output directory:
[DEBUG] [PROTOC]  c:cygwin64homedancodeserverprotocoltargetgenerated-sourcesprotobufjava
[DEBUG] [PROTOC] Protobuf descriptors:
[DEBUG] [PROTOC]  c:cygwin64homedancodeserverprotocolsrcmainprotomessage.proto
[DEBUG] [PROTOC] Command line options:
[DEBUG] [PROTOC]
    --proto_path=c:cygwin64homedancodeserverprotocolsrcmainproto
    --java_out=c:cygwin64homedancodeserverprotocoltargetgenerated-sourcesprotobufjava
    c:cygwin64homedancodeserverprotocolsrcmainprotomessage.proto
[INFO] Compiling 1 proto file(s) to c:cygwin64homedancodeserverprotocoltargetgenerated-sourcesprotobufjava
[ERROR] PROTOC FAILED: c: warning: directory does not exist. c:cygwin64homedancodeserverprotocolsrcmainprotomessage.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).

您使用Cygwin构建的可执行文件将取决于完整的Cygwin环境,并且将表现为Cygwin程序,无论您如何执行它们。 也就是说,如果您从非Cygwin shell执行Cygwin程序,它仍然会像Cygwin程序一样运行。 Cygwin程序不接受使用反斜杠和驱动器号的Windows风格路径; 你需要使用eg /cygdrive/c/而不是c:

一般来说,你不应该试图从非Cygwin shell中使用Cygwin编译的命令行工具。 相反,请尝试使用MSVC或MinGW构建protoc ,或者使用Google提供的预建的Windows二进制文件。

链接地址: http://www.djcxy.com/p/64789.html

上一篇: Protoc error in Windows

下一篇: have to create java pojo for the existing proto includes Map