grpc
grpc copied to clipboard
Errors compiling with external protobuf and abseil
What version of gRPC and what language are you using?
grpc v1.30.2
What operating system (Linux, Windows,...) and version?
Linux Mint 19
What runtime / compiler are you using (e.g. python version or version of gcc)
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
What did you do? What did you expect to see? What did you see instead?
I am trying to build protobuf against external installations of abseil and protobuf that are not in the standard system installation locations, ie /usr/include
. In doing this I had to overcome two specific issues that I wanted to get clarification on usage or input so that I could help contribute the modifications back to the repo.
- Issues with referencing an external directory for protobuf installation.
When I specified the -DgRPC_PROTOBUF_PROVIDER=package
flag at build time, the FindProtobuf.cmake
file does not resolve the installation without additional information. I was able to make this work by providing the -DProtobuf_ROOT=${protobuf_install_location}
and -DCMAKE_POLICY_DEFAULT_CMP0074=NEW
flags at build time as well. A couple of suggested improvements here could make this easier, either adding the cmake_policy(SET CMP0074 NEW)
insde the cmake/protobuf.cmake
file or potentially exposing an additional variable like -DgRPC_PROTOBUF_ROOT
. Also adding some addition documentation on how to handle this specific case.
- Abseil package provider not available.
When specifying -DgRPC_ABSL_PROVIDER=package
flag there is an error:
CMake Error at cmake/abseil-cpp.cmake:38 (find_package):
Could not find a package configuration file provided by "absl" with any of
the following names:
abslConfig.cmake
absl-config.cmake
Even with the CMP0074 policy set, something like adding DABSL_ROOT=${abseil_install_location}
still does not work. I was able to make it work by providing the install location with the -DCMAKE_PREFIX_PATH
argument. Maybe either making some adjustments in cmake/abseil-cpp.cmake
or adding a new cmake/modules/FindAbsl.cmake
file would make this behavior a little more natural?
Anything else we should know about your project / environment?
I am using cmake version 3.18.0
Get exactly the same issue trying to install to docker with the following dockerfile:
FROM debian:stretch
RUN apt-get update && apt-get install -y \
build-essential autoconf libtool git pkg-config cmake \
&& apt-get clean
# install protobuf first, then grpc
ENV GRPC_RELEASE_TAG v1.35.x
RUN git clone -b ${GRPC_RELEASE_TAG} https://github.com/grpc/grpc /var/local/git/grpc && \
cd /var/local/git/grpc && \
git submodule update --init && \
echo "--- installing protobuf ---" && \
mkdir -p cmake/build && \
cd cmake/build && \
cmake ../.. && \
make && \
cmake ../.. -DgRPC_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package && \
make && make install
Tried both ENV GRPC_RELEASE_TAG v1.35.x and v1.37.x with the same error.
I was able to make it work by providing the install location with the
-DCMAKE_PREFIX_PATH
argument. Maybe either making some adjustments incmake/abseil-cpp.cmake
or adding a newcmake/modules/FindAbsl.cmake
file would make this behavior a little more natural?
@jgornowich, could you provide the command that got it working for you?
Friendly ping as this is still reproducible
Still reproducible :(
Still having the problem in ~2023~ 2024.
looks like the "lang/other" tag resulted in this not getting attention.. should have been C++
@jgornowich How did you install protobuf and absl? We install protobuf and absl in our CI and haven't run into such issues.
@Scrier In your example, I don't see a command to install protobuf.
@yashykt : I am not installing it , im building it from source and installing it. with the make && make install
@Scrier I meant that your commands use gRPC_PROTOBUF_PROVIDER=package
but it doesn't seem that you are installing protobuf. Can you remove that option and try again?
More than 30 days have passed since label "disposition/requires reporter action" was added. Closing this issue. Please feel free to re-open/create a new issue if this is still relevant.