Vcpkg: [port grpc] Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)

Created on 16 Jul 2019  路  8Comments  路  Source: microsoft/vcpkg

When running vcpkg.exe install grpc:x64-windows it completes successfully.
When trying to use the build output in a Qt c++ project i receive:

include\grpc\impl\codegen\port_platform.h:47: error: #error "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)"

I tried manually editing the portfile.cmake to include the build parameter which was suggested by simmilar forum entries regarding this error without success:

  • -D_WIN32_WINNT:STRING="0x600" in the vcpkg_configure_cmake() function call
  • vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_STATIC_LINKING=${gRPC_STATIC_LINKING} -DgRPC_MSVC_STATIC_RUNTIME=${gRPC_MSVC_STATIC_RUNTIME} -DgRPC_ZLIB_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG -DgRPC_CARES_PROVIDER=${cares_CARES_PROVIDER} -DgRPC_GFLAGS_PROVIDER=none -DgRPC_BENCHMARK_PROVIDER=none -DgRPC_INSTALL_CSHARP_EXT=OFF -DgRPC_INSTALL_BINDIR:STRING=tools/grpc -DgRPC_INSTALL_LIBDIR:STRING=lib -DgRPC_INSTALL_INCLUDEDIR:STRING=include -DgRPC_INSTALL_CMAKEDIR:STRING=share/grpc -DgRPC_BUILD_CODEGEN=${gRPC_BUILD_CODEGEN} -D_WIN32_WINNT:STRING="0x600" )

results in:

CMake` Warning:
Manually-specified variables were not used by the project:
_WIN32_WINNT
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
VCPKG_TARGET_ARCHITECTURE
gRPC_INSTALL_CSHARP_EXT

in /buildtrees/grpc/config-x64-windows-out.log

How can i continue from here on?

port-feature

Most helpful comment

Also ran into this. Solved it by manually editing C:\src\vcpkg\installed\x64-windows\include\grpc\impl\codegen\port_platform.h to make this modification around line 32:

if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)

+#include

ifndef WIN32_LEAN_AND_MEAN

Source: https://github.com/grpc/grpc/issues/18928

All 8 comments

I have same issue, exactly.

Also having the same issue.

I don't, but I feel the same, guys...

Also ran into this. Solved it by manually editing C:\src\vcpkg\installed\x64-windows\include\grpc\impl\codegen\port_platform.h to make this modification around line 32:

if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)

+#include

ifndef WIN32_LEAN_AND_MEAN

Source: https://github.com/grpc/grpc/issues/18928

Looking at the port_platform.h at vcpkg\installed\x64-windows\include\grpc\impl\codegen it tests the value of _WIN32_WINNT before including windows.h. This is the wrong thing to do. If you want to require a minimum version you include windows,h and then check _WIN32_WINNT. So all that need to be done is that the check, currently at about line 40 need to be move to directly after the include of windows.h at about line 50.

This is still not fixed since the gRPC package isn't updated yet to v1.30.0 which includes this fix.

GRPC is now at version 1.31.1 and this issue should be closed

Thanks for posting this issue. GRPC has been updated to version 1.31.1, this issue has been fixed. So I am closing this issue for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

F0I0l0I0P picture F0I0l0I0P  路  3Comments

jack17529 picture jack17529  路  3Comments

grandprixgp picture grandprixgp  路  3Comments

ThinkalVB picture ThinkalVB  路  3Comments

invy picture invy  路  3Comments