Protocol-buffers symbol lookup error on Linux

Viewed 615

My Java Grpc proto project is building fine locally on a Windows PC but the build is failing on a Linux PC with below error. Any one has any info on this error? I appreciate your suggestions.

[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.

I am trying to write custom validation and used below project as reference https://github.com/entur/protobuf-validation

Here is the build snippet of my 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>

Here is myvalidation.proto file:

syntax = "proto2";
option java_multiple_files = true;
import "google/protobuf/descriptor.proto";
package validation;

extend google.protobuf.FieldOptions {
   optional bool required = 50001; 
}

Version of 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
1 Answers

The error you are seeing is not from the Protoc executable itself. The "symbol lookup error (undefined symbol)" means that a linked library could not be found. Most likely Protoc is linked against a symbol used in a newer library than the one you have installed. In this case, referring to the symbol _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE, it seems to be an issue with the shared GNU C Library (e.g. glibc).

In your newest edit you shared that you are using glibc 2.5 which was released around 15 years ago. I strongly suggest that you install a newer version of glibc. Most likely your operating system is also in dire need of an upgrade.

Related