Installing Protobuf
CentOS
- Query the Protobuf version. If the Protobuf version is not 2.5.0, delete Protobuf and reinstall it. If the Protobuf version is 2.5.0, skip this section.
protoc --version
- Delete Protobuf as follows:
yum remove -y protobuf protobuf-devel
- Install Protobuf 2.5.0.
1yum install -y protobuf protobuf-devel
- Check whether Protobuf is installed successfully.
1protoc --versionThe installation is successful if information similar to the following is displayed:

- Install Maven.
1mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-aarch_64 -Dpackaging=exe -Dfile=/usr/bin/protoc
openEuler
- Query the Protobuf version. If the Protobuf version is not 2.5.0, delete Protobuf and reinstall it. If the Protobuf version is 2.5.0, skip this section.
protoc --version
- Delete Protobuf as follows:
yum remove -y protobuf protobuf-devel
- Query the Protobuf path and delete the Protobuf soft link.
- Query the Protobuf path.
which protoc

- Go to the /usr/local/bin directory and delete the /protoc directory. See the preceding figure.
cd /usr/local/bin rm -rf /protoc
- Query the Protobuf path.
- Go to the /opt/tools/installed/ directory.
1cd /opt/tools/installed
- Download and decompress the source code.
1 2
wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz --no-check-certificate tar -zxf protobuf-2.5.0.tar.gz
- Download the protoc.zip package and decompress it to obtain the protoc.patch file whose storage path can be customized, for example, to /opt/tools/installed/protobuf-2.5.0/src/google/protobuf/stubs/.
1 2 3
wget https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/bigdata/Patch/protoc.zip --no-check-certificate unzip protoc.zip cp ./protoc/protoc.patch ./protobuf-2.5.0/src/google/protobuf/stubs/
- Go to the /opt/tools/installed/protobuf-2.5.0/src/google/protobuf/stubs/ directory and install the patch.
1 2
cd protobuf-2.5.0/src/google/protobuf/stubs/ patch -p1 < protoc.patch
- Go back to the root directory of protobuf-2.5.0, compile the file, and install it in the default directory.
1 2
cd /opt/tools/installed/protobuf-2.5.0 ./autogen.sh && ./configure CFLAGS='-fsigned-char' && make -j8 && make install
- Deploy Protoc in the local Maven repository.
mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-aarch_64 -Dpackaging=exe -Dfile=/usr/local/bin/protoc
- Reload environment variables.
source /etc/profile
- Check the Protobuf version.
If the version is not 2.5.0, perform Installing Protobuf again.
protoc --version
Parent topic: Configuring the Compilation Environment