grpc(c++)安装

1. 安装依赖:

首先安装 pkg-config:sudo apt-get install pkg-config
然后安装依赖文件:
sudo apt-get install autoconf automake libtool make g++ unzip
sudo apt-get install libgflags-dev libgtest-dev
sudo apt-get install clang libc++-dev

2.下载grpc

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

3.安装 protobuf 源码

cd third_party/protobuf/
git submodule update --init --recursive //确保克隆子模块,更新第三方源码
./autogen.sh //生成配置脚本
./configure --prefix=/usr/local //生成Makefile文件,为下一步的编译做准备,可以加上安装路径:--prefix=path
make //从Makefile读取指令,然后编译
make check //可能会报错,但是不影响
sudo make install
从 Makefile 读取指令,安装到指定位置,默认为 /usr/local/,也可以指定安装目录:--prefix=path。卸载的命令为 make uninstall。

4.安装GRPC

cd ../.. //进入 grpc 根目录
make //从Makefile读取指令,然后编译
sudo make install
从 Makefile 读取指令,安装到指定位置,默认为 /usr/local/,具体的位置在 bin 和 lib 目录下。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容