grpc: In C++, when building using cmake, got fatal error: absl/synchronization/mutex.h: No such file or directory
What version of gRPC and what language are you using?
grpc v1.37.0 C++ cmake version: 3.20.1
What operating system and version?
Inside Docker container (using GCC image pulled from https://hub.docker.com/_/gcc) Linux version 5.8.8-1.el7.elrepo.x86_64 (mockbuild@Build64R7) (gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), GNU ld version 2.32-16.el7
What runtime / compiler are you using (e.g. python version or version of gcc)
GCC version: gcc (GCC) 10.3.0
Issue description In C++, When building using cmake, got fatal error: absl/synchronization/mutex.h: No such file or directory
Steps to reproduce the issue Follow the steps as shown in https://grpc.io/docs/languages/cpp/quickstart/
In the below step:-
Error:
Solution:
I copied the absl folder from grpc/third_party/abseil-cpp/absl
and pasted it into /usr/local/include/
as shown below:
cp -r /grpc/third_party/abseil-cpp/absl /usr/local/include/
Later, it worked fine:
Please fix this bug (So that we need not manually copy-paste the absl folder)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 18 (7 by maintainers)
Hi @veblush when I try to install abseil using the commands you put here, I got the following long error. error.log do you know what the problem could be here? I’m running macOS Big Sur v11.2.3, Apple clang version 12.0.0 (clang-1200.0.32.29), and working off the v1.37.0 grpc branch
UPDATE: Fixed by ensuring CMake used the correct C++ version by adding
set(CMAKE_CXX_STANDARD 17)
at the very top ofabseil-cpp/CMakeLists.txt
@chandanpasunoori It’s solved from 1.41
@Puneethgr Thanks for the commands to reproduce it. I saw the same error and it turns out that the doc needs to update. In the meantime, you can fix it by installing abseil in advance.
Before building example on grpc directory,
So, while I have the same issue, after I copy and pasted the absl folder, it seems that linking against grpc in another makefile failed because absl_base cannot be found.
The .pc files do exist, but they’re all prefixed with absl_ so absl_base is actually absl_absl_base.