Linux版本:CentOS 6.3
更多yum命令详解:http://www.cnblogs.com/chuncn/archive/2010/10/17/1853915.html
1、下载2.5.0
https://code.google.com/p/protobuf/
2、解压后上传到linux相应的目录后,执行下面命令
./configure && make
3、执行命令后可能会出现下面几种错误
A错误:
[root@pc-linux protobuf2.5]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/protobuf2.5':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
#原因,在linux没有安装GCC组件
解决办法是:在centos
首先自动搜索最快镜像插件: yum install yum-fastestmirror
最后再执行:yum install gcc
B错误:
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 `/usr/protobuf2.5':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
#原因 linux系统缺失安装gcc-c++
解决办法:在centos 终端下运行
yum install gcc-c++ 即可
检查Gcc组件是否安装成功(表示成功)
[root@pc-linux /]# gcc
gcc: 没有输入文件
检查protobuf组件是否安装成功(表示成功)
[root@linux-core2 protobuf2.5.0]# protoc
Missing input file.