GRPC 编译-- Ubuntu

环境 Ubuntu 20.04.3 LTS

gcc 9.4.0

cmake version 3.16.3

下载源码

git clone https://github.com/grpc/grpc.git
git checkout  v1.55.0
git submodule update --init --recursive

编译

cd grpc
mkdir cmake/build
cd cmake/build
export MY_INSTALL_DIR=/opt/grpc_install
mkdir /opt/grpc_install -p
cmake -DgRPC_INSTALL=ON -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR ../..
make -j8
make install

编译时注意要在grpc/cmake/build中,我在grpc 目录中创建build目录,执行cmake 会有很多奇怪的错误。

很顺利,一次成功

编译helloworld

cd examples/cpp/helloworld/
mkdir cmake/build -p
cd cmake/build
export MY_INSTALL_DIR=/opt/grpc_install
cmake -DCMAKE_PREFIX_PATH=$MY_INSTALL_DIR ../..
make 

运行 greeter_server 和 greeter_client

猜你喜欢

转载自blog.csdn.net/wjmasd/article/details/129237649
今日推荐