java - Linux 上的 Protocol Buffer 符号查找错误

标签 java linux maven protocol-buffers grpc

我的 Java Grpc proto 项目在 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 的构建片段:

<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

最佳答案

您看到的错误不是来自 Protoc可执行本身。 “符号查找错误( undefined symbol )”表示找不到链接库。最有可能 Protoc链接到比您安装的库更新的库中使用的符号。在这种情况下,引用符号 _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE ,这似乎是共享 GNU C 库(例如 glibc)的问题。
在您最新的编辑中,您分享了您正在使用大约 15 年前发布的 glibc 2.5。我强烈建议您安装较新版本的 glibc。最有可能的
您的操作系统也急需升级。

关于java - Linux 上的 Protocol Buffer 符号查找错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68101337/

相关文章:

linux - 如何在前台运行 docker-compose start ?

maven - 存储没有版本号的 Nexus/Maven Artifact

java - 在 Spring 中覆盖库版本

java - 无法获取 Derby 10.15 的驱动程序实例

java - Android Facebook SDK 使用 OnSelectionChangeListener 获取选定用户时出现问题

java - 文本在我的多客户端聊天 GUI 应用程序中不可见?

c++ - 通用生成文件

java - 矩形面向对象开发——Equals()方法

java - 子类化 UISelectMany 以创建自定义 JSF 组件

linux - 如何在回声中传递较旧的日期?