參考文章:
https://www.jianshu.com/p/1c2069254045
https://blog.csdn.net/guyongqiangx/article/details/52759578
https://blog.csdn.net/foolishlee/article/details/50910426
1, clone 源碼到本地,切換到 v3.18.1 這個 tag
git clone https://github.com/google/protobuf.git
git checkout v3.18.1
2, 生成配置文件
./autogen.sh
第一個報錯:
configure.ac:109: error: possibly undefined macro: AC_PROG_LIBTOOL
安裝 libtool 解決:sudo apt install libtool
第二個報錯:
configure.ac:109: error: required file './ltmain.sh' not found
手動執行一次 libtoolize 解決:libtoolize
3, 編譯安裝
./configure
make
make install
4, 刷新庫文件 cache
sudo ldconfig