1 下载protobuf
https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
2 进入下载文件的目录
tar -zxvf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1/
./configure --prefix=/usr
报错:
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/root/protobuf-2.6.1':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
3 安装gcc 环境
apt-get install gcc
- 安装G++环境
app install g++
- ./configure --prefix=/usr
安装成功
- 编译
make
make check
sudo make install
如果没有make 则先安装make apt install make