在 Ubuntu 上安裝 Protobuf 3

依次執行下列命令:

sudo apt-get install autoconf automake libtool curl make g++ unzip

git clone https://github.com/google/protobuf.git

// 指定分支clone

git clone -b 3.9.x https://github.com/google/protobuf.git     // 3.9.x爲指定分支

cd protobuf

git submodule update --init --recursive                    

./autogen.sh

./configure

make

make check

sudo make install

sudo ldconfig # refresh shared library cache.

 

 

可能遇到問題

很有可能,執行過程中會出現以下錯誤提示:

./autogen.sh: 4: ./autogen.sh: autoreconf: not found

 

解決辦法:執行以下命令即可。

1

2

3

sudo apt-get install autoconf

sudo apt-get install automake

sudo apt-get install libtool

安裝完成之後

執行以下命令驗證安裝結果,查看版本號。

protoc --version

發佈了18 篇原創文章 · 獲贊 6 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章