首先安装protocbuf
protocbuf下载路径:https://github.com/protocolbuffers/protobuf/releases
按照下面步骤安装:
#解压
tar xzf protobuf-all-3.11.4.tar.gz
#编译并安装
cd protobuf-all-3.11.4
./configure --prefix=/usr/local/protobuf-3.11.4
make
sudo make install
#配置环境变量
cd -
vim .bashrc
export PATH="$PATH:/usr/local/protobuf-3.11.4/bin"
export PKG_CONFIG_PATH=/usr/local/protobuf-3.11.4/lib/pkgconfig
#使之生效
source .bashrc
#配置动态库
sudo vim /etc/ld.so.conf
/usr/local/protobuf-3.11.4/lib
/usr/local/protobuf-c-1.3.2/lib
#使之生效
sudo ldconfig
安装protobuf-c
protocbuf下载路径:https://github.com/protobuf-c/protobuf-c.git
按照下面步骤安装:
#解压
tar zxf protobuf-c-1.3.2.tar.gz
#编译并安装
cd protobuf-c-1.3.2/
./configure --prefix=/usr/local/protobuf-c-1.3.2
make
sudo make install
#配置环境变量
cd -
vim .bashrc
export PATH="$PATH:/usr/local/protobuf-c-1.3.2/bin"
#使之生效
source .bashrc