Search code examples
protocol-buffersgrpcc-ares

Can't build project with gRPC on Linux x64 Release configuration


I have a project that use gRPC. It successful build on any configuration on Windows(Debug\Release) and on Debug configuration on Linux. But in Release mode I have next error:

ld: cannot find -lnsl

In CMake output(link.txt):

#debug build
...
 /home/user/data/c-ares/1.15.0/debug/lib/libcares.a /home/user/data/grpc/1.23.0/debug/lib/libaddress_sorting.a
...
#release build
...
 /home/user/data/c-ares/1.15.0/release/lib/libcares.a -lnsl /home/user/data/grpc/1.23.0/release/lib/libaddress_sorting.a
...

What is that strange additional dependence -lnsl? And how to resolve it?


Solution

  • To resolve it, CONAN_PKG::grpc should be used. From here: https://stackoverflow.com/a/58589246/4481855