Installation protobuf

First, download protobuf

Method One: ===> git clone https://github.com/protocolbuffers/protobuf.git

Method two: ===> or drag prepared compressed packet
decompression
Unzip protobuf1.zip

 

Second, the installation (the Linux the Ubuntu)
(. 1) is mounted reliance tool
$ sudo apt-get install autoconf automake libtool curl make g ++ unzip libffi-dev -y

(2) into the protobuf file
cd protobuf /

(3) installed to detect and generate automatic installation script
./autogen.sh
./configure

(4) C code is compiled
make

(5) installed
sudo make install

(6) to refresh the relationship shared library Linux
sudo ldconfig

 

Third, the test protobuf compilation tools
protoc -h
If the instruction is not related to the normal output report any error, for the successful installation

 

Fourth, get golang language of proto pack

(1) Download
Method a: ===> go get -v -u github.com/golang/protobuf/proto
Method two: ===> or $ github.com-golang-protobuf.zip drag to decompress GOPATH / src / github.com / golang

(2) into the folder compiled
$ cd $ GOPATH / src / github.com / golang / protobuf / Protoc-Gen-Go /
$ Go Build

(3) the generated protoc-gen-go executable file in / bin directory
$ sudo cp protoc-gen-go / bin /

Guess you like

Origin www.cnblogs.com/a208606/p/10949327.html