因工作需要,要编译Object-C可用的Protocbuf,开始查资料,
http://www.cnblogs.com/uniy/archive/2011/12/21/2296405.html
结果执行完
A. 下载Protocol Buffers将下载解压后的文件存放至Applications目录下,进到ProtocolBuffers-2.2.0-Source目录看看会发现 有个src目录。用命令切换至ProtocolBuffers-2.2.0-Source目录下。
下载地址: http://code.google.com/p/metasyntactic/downloads/list
B. ./autogen.sh
C. ./configure (如果说没有权限,chmod +x configure)
D. make
之后发现src下没有protoc这个可执行文件,看下log
./autogen.sh: line 28 : autoreconf: command not found
是因为autoconf没安装,继续查资料
找到安装autoconf的方法
http://igaojie.com/webdev/562.html
curl -O http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz tar -xzvf m4-1.4.13.tar.gz cd m4-1.4.13 ./configure –prefix=/usr/local make sudo make install cd .. curl -O http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz tar -xzvf autoconf-2.65.tar.gz cd autoconf-2.65 ./configure –prefix=/usr/local make sudo make install cd .. curl -O http://mirrors.kernel.org/gnu/automake/automake-1.11.tar.gz tar xzvf automake-1.11.tar.gz cd automake-1.11 ./configure –prefix=/usr/local make sudo make install cd .. curl -O http://mirrors.kernel.org/gnu/libtool/libtool-2.2.6b.tar.gz tar xzvf libtool-2.2.6b.tar.gz cd libtool-2.2.6b ./configure –prefix=/usr/local make sudo make install
安装完成后重新执行
cd /Applications/ProtocolBuffers-2.2.0-Source
./autogen.sh
./configure
make
发现make之后出现error:
google/protobuf/message.cc:130:60:error:implicit instantiation of undefined
继续查资料,
http://blog.csdn.net/fangzhangsc2006/article/details/17364057
在ProtocolBuffers-2.2.0-Source/src/google/protobuf/message.cc中头部加上#include <istream>
重新编译protobuf,
protoc终于出来了。