Step 1: Get the build tools.
If you have all the build tools installed then skip ahead, but on the particular machine that I was using it didn't. So I had to do the following:
Install Xcode command line tools
xcode-select --install
Install the GNU build tools (autoconf, automake, libtool):
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar -xzf autoconf-latest.tar.gz
cd autoconf-2.69./configure && make && sudo make install
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2./configure && make && sudo make install
curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
tar -xzf automake-1.14.tar.gz
cd automake-1.14
./configure && make && sudo make install
Step 2: Get the Protocol Buffer Compiler and Build It
git clone git://github.com/google/protobuf
cd protobuf
./autogen.sh
configure
make
sudo make install
Since I wanted to use protocol buffer in Go, I have to install the Go plugin for the compiler:
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
The system can now compile your proto files to let you use it in your code:
protoc --go_out=.
No comments:
Post a Comment