溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Centos7.3中怎么編譯安裝grpc

發(fā)布時間:2021-07-12 14:36:43 來源:億速云 閱讀:514 作者:Leah 欄目:云計算

這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)Centos7.3中怎么編譯安裝grpc,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

相關(guān)工具

yum install -y gcc gcc-c++ autoconf libtool
yum groupinstall -y "Development Tools"

下載源碼

git clone https://github.com/grpc/grpc.git
cd grpc
git submodule update --init

編譯安裝protobuf

cd third_party/protobuf/
./autogen.sh
./configure
make
make install
ldconfig # refresh shared library cache.
which protoc
protoc --version

autogen.sh里需要下載Google Code的代碼,需要保障其能被訪問

編譯安裝grpc

cd ../..
make

問題:

/root/git/grpc/bins/opt/grpc_cpp_plugin: error while loading shared libraries: libprotoc.so.15: cannot open shared object file: No such file or directory

解決辦法:

echo $LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib/:/root/git/grpc/libs/opt/
make
make install

測試C++ Demo

cd examples/cpp/helloworld
make

問題:

Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing `protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found

解決辦法:

echo $PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/root/git/grpc/libs/opt/pkgconfig:/root/git/grpc/third_party/protobuf
make
./greeter_server &
./greeter_client

上述就是小編為大家分享的Centos7.3中怎么編譯安裝grpc了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI