[Bug]: grpc does not compile with lts_2023_01_25 and Visual Studio 2022
- Vorherrschende Sprache
- C++
- Sterne
- 18.1k
- Forks
- 3.2k
- Ø Merge
- 20 Std. 36 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
### Describe the issue
When compiling grpc 1.52.0 with Visual Studio 2022 (17.4.4) and C++20 compilation fails with:
```
[1/43] Building CXX object CMakeFiles\grpc.dir\src\core\lib\event_engine\posix_engine\event_poller_posix_default.cc.obj
FAILED: CMakeFiles/grpc.dir/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc.obj
C:\PROGRA~1\MICROS~4\2022\PROFES~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\cl.exe /nologo /TP -DCARES_STATICLIB -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WIN32_WINNT=0x600 -D_WINSOCK_DEPRECATED_NO_WARNINGS -ID:\src\grpc\third_party\re2 -ID:\src\grpc\third_party\zlib -ID:\src\grpc\include -ID:\src\grpc -ID:\src\grpc\third_party\address_sorting\include -ID:\src\grpc\_build\third_party\re2 -ID:\src\grpc\third_party\boringssl-with-bazel\src\include -ID:\src\grpc\src\core\ext\upb-generated -ID:\src\grpc\src\core\ext\upbdefs-generated -ID:\src\grpc\third_party\upb -ID:\src\grpc\third_party\xxhash -ID:\src\grpc\_build\third_party\zlib -ID:\src\grpc\_build\third_party\cares\cares -ID:\src\grpc\third_party\cares\cares -ID:\src\grpc\third_party\cares\cares\include -ID:\src\grpc\third_party\abseil-cpp /DWIN32 /D_WINDOWS /W3 /GR /EHsc /wd4065 /wd4506 /wd4200 /wd4291 /wd4244 /wd4267 /wd4987 /wd4774 /wd4819 /wd4996 /wd4619 /wd4503 /utf-8 /MDd /Zi /Ob0 /Od /RTC1 -std:c++20 /showIncludes /FoCMakeFiles\grpc.dir\src\core\lib\event_engine\posix_engine\event_poller_posix_default.cc.obj /Fdgrpc.pdb /FS -c D:\src\grpc\src\core\lib\event_engine\posix_engine\event_poller_posix_default.cc
D:\src\grpc\third_party\abseil-cpp\absl/functional/internal/any_invocable.h(855): error C2664: 'ReturnType absl::lts_20230125::internal_any_invocable::Impl::ExtractInvoker::::()::::operator ()(absl::lts_20230125::internal_any_invocable::TypeErasedState *,T &&) noexcept(false) const': cannot convert argument 2 from 'T' to 'T &&'
with
[
ReturnType=void,
Sig=void (absl::lts_20230125::Status),
T=absl::lts_20230125::Status
]
and
[
T=absl::lts_20230125::Status
]
and
[
T=absl::lts_20230125::Status
]
D:\src\grpc\third_party\abseil-cpp\absl/functional/internal/any_invocable.h(855): note: You cannot bind an lvalue to an rvalue reference
```
Downgrading Abseil from `lts_2023_01_25` to `lts_2022_06_23` "fixes the problem. Also downgrading the C++ standard to C++ 17 fixes the compilation.
I'm unsure if the issue is one of the following:
* regression in Abseil
* wrong usage from grpc
* compiler bug in Visual Studio in C++ 20 mode (we witnessed plenty of those in the last months)
Thanks,
Gregor
### Steps to reproduce the problem
Install Visual Studio 2022 (17.4.4), CMake, Ninja, and NASM.
```
git clone https://github.com/grpc/grpc.git
cd grpc
git submodule update --init
mkdir _build
cd _build
cmake -GNinja -DCMAKE_CXX_STANDARD=20 -DCMAKE_ASM_NASM_COMPILER="C:/Program Files/NASM/nasm.exe" ..
ninja CMakeFiles\grpc.dir\src\core\lib\event_engine\posix_engine\event_poller_posix_default.cc.obj
```
### What version of Abseil are you using?
`lts_2023_01_25`
### What operating system and version are you using?
Windows 10
### What compiler and version are you using?
Visual Studio 2022 (17.4.4)
### What build system are you using?
CMake `3.25.2`
### Additional context
_No response_
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.