linux下安裝protobuf及其使用

linux下安裝protobuf及在python與php上的應用

下載解壓源文件

github上的版本發佈地址

https://github.com/protocolbuffers/protobuf/releases

下載&解壓&進入源碼目錄

當前下載protobuf2的最後一個版本
wget https://github.com/google/protobuf/archive/v2.6.1.zip

unzip v2.6.1.zip -d ./

cd protobuf-2.6.1
請根據自己的需求下載對應的版本,當前操作演示版本爲protobuf2,及.proto文件中syntax = "proto2";開頭的

安裝依賴

sudo apt-get install autoconf automake libtool
其他非debian發行版的機器安裝對應的依賴擴展即可

生成configure文件

./autogen.sh
如果無法連接google網站

修改

curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
mv gtest-1.5.0 gtest

 wget https://github.com/google/googletest/archive/release-1.5.0.tar.gz
 tar xzvf release-1.5.0.tar.gz
 mv googletest-release-1.5.0 gtest
也可由手動刪除google的連接,直接下載文件並解壓

進行configure

查看幫助

./configure -h

指定安裝目錄

./configure prefix=/opt/protobuf2 

安裝

make && make install
權限不夠的話,要使用sudo
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章