【发布时间】:2021-06-23 13:59:22
【问题描述】:
我的 Java Grpc 原型项目在 Windows PC 上本地构建良好,但在 Linux PC 上构建失败并出现以下错误。有人有关于这个错误的任何信息吗?感谢您的建议。
[ERROR] PROTOC FAILED: ERROR] /mycompany/home/jenkins/workspace/myproject/src/main/proto/myvalidation.proto [0:0]:/mycompany/home/jenkins/workspace/myproject/target/protoc-plugins/protoc-3.15.8-linux-x86_64.exe: symbol lookup error: /mycompany/home/jenkins/workspace/myproject/target/protoc-plugins/protoc-3.15.8-linux-x86_64.exe: undefined symbol: _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE [ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default) on project myproject: protoc did not exit cleanly.
我正在尝试编写自定义验证并在下面的项目中用作参考 https://github.com/entur/protobuf-validation
这是我的pom.xml 的构建 sn-p:
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>${protobuf-plugin.version}</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.15.8:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.35.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
这里是myvalidation.proto 文件:
syntax = "proto2";
option java_multiple_files = true;
import "google/protobuf/descriptor.proto";
package validation;
extend google.protobuf.FieldOptions {
optional bool required = 50001;
}
glibc 版本:
Linux Glibc version - glibc-2.5-123.el5_11.3
Linux Path I found in Jenkins - PATH=/mycompany/pkgs/linux/intel/python/2.7.11.rhas5.x86_64/bin:/mycompany/pkgs/linux/intel/mysql/5.7.22.ce.x86_64/bin:/mycompany/pkgs/linux/intel/python/2.7.11.rhas7.x86_64/bin/:/mycompany/pkgs/linux/intel/git/2.25.1.el5/bin:/mycompany/pkgs/linux/intel/sunjava2/1.8.0u51.x86_64/bin:/mycompany/pkgs/linux/intel/maven/3.5.0_ext_1.1/bin:/mycompany/pkgs/linux/intel/git/2.25.1.el5/bin:/mycompany/pkgs/linux/intel/python/2.7.11.rhas5.x86_64/bin:/mycompany/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mycompany/pkgs/linux/intel/opensrc/1.0/bin:/mycompany/pkgs/linux/intel/git/2.25.1.el7/bin:/mycompany/pkgs/linux/intel/python/3.8.1.el7.slim/bin:/mycompany/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mycompany/pkgs/linux/intel/opensrc/1.0/bin
【问题讨论】:
-
您明确指定了作为 Windows 可执行文件的 EXE 文件。在 Linux 上应该以不同的方式完成吗?
-
您可以尝试从
protobuf-mavcn-plugin的configuration中删除pluginId和pluginArtifact吗?参考:xolstice.org/protobuf-maven-plugin/examples/…
标签: java linux maven protocol-buffers grpc