Centos7.3编译安装grpc

相关工具

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

转载于:https://my.oschina.net/u/3589495/blog/1858171

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值