Cpp(九) gRPC protobuf for C++ 基本使用

Mac gRPC for C++

#0 源码

Mac: https://github.com/Coxhuang/FKCpp/tree/master/gRPCDemo/macOS

Ubuntu: https://github.com/Coxhuang/FKCpp/tree/master/gRPCDemo/ubuntu

#1 环境

C++14
Python 3.8
macOS 10.5.15
Ubuntu 16.04
cmake 3.18.2 
proto 3
Clion

#2 安装

  • macOS

使用brew安装

  • Ubuntu
  1. 安装依赖
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
  1. 下载grpc源码(国内镜像)
git clone https://gitee.com/mirrors/grpc-framework grpc
  1. 修改 submodule

GitHub的submodule下载很慢很慢, 一天都下不下来

cd grpc
vim .gitmodules // 查看文件里的submodule, 将GitHub改成Gitee
[submodule "third_party/zlib"]
	path = third_party/zlib
	url = https://gitee.com/Coxhuang/zlib
	# When using CMake to build, the zlib submodule ends up with a
	# generated file that makes Git consider the submodule dirty. This
	# state can be ignored for day-to-day development on gRPC.
	ignore = dirty
[submodule "third_party/protobuf"]
	path = third_party/protobuf
	url = https://gitee.com/Coxhuang/protobuf.git
[submodule "third_party/googletest"]
	path = third_party/googletest
	url = https://gitee.com/Coxhuang/googletest.git
[submodule "third_party/benchmark"]
	path = third_party/benchmark
	url = https://gitee.com/Coxhuang/benchmark
[submodule "third_party/boringssl-with-bazel"]
	path = third_party/boringssl-with-bazel
	url = https://gitee.com/Coxhuang/boringssl.git
[submodule "third_party/re2"]
	path = third_party/re2
	url = https://gitee.com/Coxhuang/re2.git
[submodule "third_party/cares/cares"]
	path = third_party/cares/cares
	url = https://gitee.com/Coxhuang/c-ares.git
	branch = cares-1_12_0
[submodule "third_party/bloaty"]
	path = third_party/bloaty
	url = https://gitee.com/Coxhuang/bloaty.git
[submodule "third_party/abseil-cpp"]
	path = third_party/abseil-cpp
	url = https://gitee.com/Coxhuang/abseil-cpp.git
	branch = lts_2020_02_25
[submodule "third_party/envoy-api"]
	path = third_party/envoy-api
	url = https://gitee.com/Coxhuang/data-plane-api.git
[submodule "third_party/googleapis"]
	path = third_party/googleapis
	url = https://gitee.com/Coxhuang/googleapis.git
[submodule "third_party/protoc-gen-validate"]
	path = third_party/protoc-gen-validate
	url = https://gitee.com/Coxhuang/protoc-gen-validate.git
[submodule "third_party/udpa"]
	path = third_party/udpa
	url = https:/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值