什么時候需要安裝
如果使用 protoc 命令,遇到 Protoc not found,表示未安裝。或者,執(zhí)行時出現(xiàn)錯誤:This parser only recognizes "proto2",則表示不是3.0版。
安裝過程及可能遇到的問題
安裝指令
詳細介紹請參考此文:protobuf簡單介紹和ubuntu 16.04環(huán)境下安裝
依次執(zhí)行以下命令,下載源碼編譯安裝,需要較長時間,超過10分鐘。
sudo apt-get install autoconf automake libtool curl make g++ unzip
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig # refresh shared library cache.
可能遇到問題
很有可能,執(zhí)行過程中會出現(xiàn)以下錯誤提示:
./autogen.sh: 4: ./autogen.sh: autoreconf: not found
解決辦法:執(zhí)行以下命令即可。
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
安裝完成之后
執(zhí)行以下命令驗證安裝結果,查看版本號。
protoc --version
恭喜得到:libprotoc 3.9.0 或更高版本號。
總結
以上所述是小編給大家介紹的在 Ubuntu 上安裝 Protobuf 3 的教程,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉載,煩請注明出處,謝謝!