# install dependencies,it's easy here
sudo apt install -y cmake
# install basic tools
sudo apt install -y build-essential autoconf libtool pkg-config
# clone from github and install it,I installed v1.51.1 here
git clone --recurse-submodules -b v1.51.1 https://github.com/grpc/grpc
cd grpc
# use Bazel to build
# Failed to use cmake build at last time
# install Bazel
sudo apt install curl gnupg
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" \
| sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel
sudo apt update && sudo apt full-upgrade
sudo apt install openjdk-11-jdk
# Build gRPC
bazel build :all
bazel test --config=dbg //test/...
# Install
cmake -DgRPC_INSTALL=ON \ ./
make
make install
After finishing the followings,how to make sure gRPC is installed successfully?
Just run the example given by the reprosity. In example/cpp/helloworld/
path,you just to do this:
mkdir -p cmake/build
pushd cmake/build
cmake -DCMAKE_PREFIX_PATH=$MY_INSTALL_DIR ../..
make -j
And then do:
./greeter_server
./greeter_client
And I can make sure gRPC is installed now.
I started to install gRPC since yesterday and I have done it now. It costs me two full day to install it.
I looked up some blogs and pages which guide to install gRPC:
Some helped me,but some disturbed me a lot:(
It's unblievable that in ubuntu I cannot install g++ which is a so bisic library. But it happened. It caused when I change
my ubuntu /etc/apt/sources.list
,I do sudo apt update
but I forgot to run sudo apt upgrade
,so it cannot install g++