U
U
Urukhayy2018-08-02 17:49:47
linux
Urukhayy, 2018-08-02 17:49:47

How to properly install gRPC c++?

Installed according to the instructions from the official site . Here is a list of commands, taking into account the location in the directories:

git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
cd grpc
git submodule update --init

make

cd third_party/protobuf
make && sudo make install

Then, according to the instructions, you need to go to the folder:
cd examples/cpp/helloworld/
And compile the sample application on grpc , and then run it. At the time of compiling the sample application on grpc , an error appeared:
Package grpc was not found in the pkg-config search path.
Perhaps you should add the directory containing `grpc.pc' to the PKG_CONFIG_PATH environment variable

There was nothing in the instructions about adding this directory to PKG_CONFIG_PATH , maybe it should have been added automatically? I found this directory in the root of the repository, in the libs/opt folder, and wrote it manually (this was not in the official instructions):
export PKG_CONFIG_PATH=<REPOSITORY ROOT>/libs/opt/pkgconfig/

After that, the error above went away, but another one remained:
In file included from helloworld.grpc.pb.cc:6:0:
helloworld.grpc.pb.h:24:55: fatal error: grpcpp/impl/codegen/async_generic_service.h: Нет такого файла или каталога

The grpccpp directory itself is also stored in the root of the repository, in the includes folder. There is nothing in the manual about connecting it. Should it also be added manually or did make grpc originally have to add all the paths itself?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
4
4rtzel, 2018-08-02
@Urukhayy

Try:

git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
cd grpc
git submodule update --init

make
sudo make install # <<< установка grpc

cd third_party/protobuf
make && sudo make install

And don't forget that pkg-config must be installed prior to calling these commands, as well as other dependencies.
You can check that everything is installed correctly as follows:
pkg-config --libs grpc
    -L/usr/local/lib -lgrpc

pkg-config --libs protobuf
    -L/usr/local/lib -lprotobuf -pthread -lpthread

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question