Protobuf installation and use

 

1. What is it?
  Google Protocol Buffer (Protobuf for short) is a portable and efficient structured data storage format, platform-independent, language-independent, scalable, and can be used in communication protocols and data storage and other fields.

2. Why use it?
  - Platform independent, language independent, and extensible;
  - Provides a friendly dynamic library, easy to use;
  - Fast parsing speed, about 20-100 times faster than the corresponding XML;
  - Serialized data is very concise and compact, compared with XML , the amount of data after serialization is about 1/3 to 1/10.

3. How to install?
  Source code download address:  https://github.com/google/protobuf 
  Installation dependent libraries: autoconf automake libtool curl make g++ unzip  
installation:

1 $ ./autogen.sh
2 $ ./configure
3 $ make
4 $ make check
5 $ sudo make install

 

 

start to solve

This tutorial is suitable for tossing for a long time and not doing anything, helpless. and cannot be uninstalled (shared server with others)

The central idea is to find the protoc recognized by the system and replace it with the version you want.

you need to

1. The protobuf version you need

2. Where is this version installed by you?

3. Where is the protobuf version approved by your system?

4. Tell your system where to find lib

1 Install the protobuf you need

There is nothing to say about this, but I remind you that it is best to use prefix to install it in the directory you specify, .configure --help to see how to use prefix

 

./configure --prefix=/root/LT

 

 

 

2. Find the protobuf you just installed

Go into his lib folder:

For example, I installed it in the LT folder unusually: do not take the usual path, remember this protoc.

 

 3. Find out where the protoc recognized by your system is

Terminal input:

You can also use the command line to find this protoc, rename it, such as protoc_origin, and paste the version you want. Then enter

 

protoc --version

 

 4. Create libprotobuf.conf in the /etc/ld.so.conf.d folder

 I installed it in such a wonderful folder as LT, as I said before, so my lib is also here. So I'm going to enter /root/LT/lib inside

Guess you like

Origin blog.csdn.net/qq_27403925/article/details/109171276
Recommended