执行命令如下:
export MY_INSTALL_DIR=$HOME/.local mkdir -p $MY_INSTALL_DIR export PATH="$MY_INSTALL_DIR/bin:$PATH" wget -q -O cmake-linux.sh https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6-Linux-x86_64.sh sh cmake-linux.sh -- --skip-license --prefix=$MY_INSTALL_DIR rm cmake-linux.sh cmake --version sudo apt-get update sudo apt-get upgrade sudo apt install -y build-essential autoconf libtool pkg-config sudo apt-get install git git --version git clone --recurse-submodules -b v1.43.0 https://github.com/grpc/grpc cd grpc mkdir -p cmake/build pushd cmake/build cmake -DgRPC_INSTALL=ON \ -DgRPC_BUILD_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR \ ../.. make -j make install popd
官方参考文档: https://grpc.io/docs/languages/cpp/quickstart/