Centos安装protobuf-c方法

安装protobuf

protobuf-c 1.2.1版本支持Protobuf 2.6.0以上,笔者安装的是Protobuf2.6.1

wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz

tar xvf protobuf-2.6.1.tar.gz

cd protobuf-2.6.1

./configure                                                              

make                                                                     

make check                                                                

make install

 

 

安装protobuf-c

 

wget https://github.com/protobuf-c/protobuf-c/releases/download/v1.2.1/protobuf-c-1.2.1.tar.gz

tar xvf protobuf-c-1.2.1.tar.gz

cd protobuf-c-1.2.1

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig   // 指定protobuf.pc文件所在

./configure

make

make install

 

如果没有使用export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig,在./configure这步可能会报错:

No package 'protobuf' found

 

这是因为Makefile中会用pkg-config命令检测环境变量,但是没有设置PKG_CONFIG_PATH,找不到protobuf.pc这个文件。

 

笔者下载的当前最新版protobuf-c 1.2.1,支持Protobuf 2.6.0以上。

你可能感兴趣的:(Linux)