protobuf編譯安裝

2021-09-24 20:57:40 字數 1119 閱讀 5183

github上有詳細的安裝說明:

1、確定centos7上已經安裝了下面的軟體,或者直接用yum進行更新

autoconf

automake

libtool

curl (used to download gmock)

make

g++unzip

tar -zxvf protobuf-3.1.0.tar.gz -c /usr/local/

cd protobuf-3.1.0/

# 如果使用的不是原始碼,而是release版本 (已經包含gmock和configure指令碼),可以略過這一步

./autogen.sh

# 指定安裝路徑

./configure --prefix=/usr/local/protobuf

#編譯make

# 測試,這一步很耗時間

make check

make install

# refresh shared library cache.

ldconfig

注意make check這一步會花費比較多的時間

3、設定一下環境變數 /etc/profile

# (動態庫搜尋路徑) 程式載入執行期間查詢動態鏈結庫時指定除了系統預設路徑之外的其他路徑

export ld_library_path=$ld_library_path:/usr/local/protobuf/lib

# (靜態庫搜尋路徑) 程式編譯期間查詢動態鏈結庫時指定查詢共享庫的路徑

export library_path=$library_path:/usr/local/protobuf/lib

export path=$path:/usr/local/protobuf/bin

4、檢視版本

protoc --version
之後,對於相同的系統環境,就不需要再編譯了,直接將編譯好的protobuf(目錄:/usr/local/protobuf)分發到其他計算機,設定環境變數即可。

protobuf編譯安裝

安裝新增環境變數 解除安裝依次輸入 configure make j8 make check sudo make install其中,configure可以通過引數來制定安裝位置,如 configure prefix path path 換成指定的位置 推薦安裝到 usr下,這樣會和apt get ...

protobuf 編譯安裝

1 protobuf是google公司提出的資料儲存格式,詳細介紹可以參考 tar zxf protobuf 2.5.0.tar.gz mkdir usr local protobuf 2.5.0 cd usr local protobuf 2.5.0 opt protobuf 2.5.0 conf...

mac編譯安裝protobuf

1 在安裝protobuf之前需要先安裝git make automake等工具,安裝方法請參考 2 在安裝好protobuf後需要安裝protobuf,依賴庫,首先使用 git clone 轉殖,如下圖所示 3 然後進入到protobuf目錄執行.autogen.sh,此時會出現 configur...