tikv / grpc-rs

The gRPC library for Rust built on C Core library and futures
Apache License 2.0
1.8k stars 253 forks source link

Failed to build on windows #620

Open MichaelScofield opened 1 year ago

MichaelScofield commented 1 year ago

Describe the bug

Unable to build grpc-rs on the latest windows 11. Here's the error logs: (from cargo build)

PS D:\repo\grpc-rs\grpc-sys> cargo build
warning: patch for `grpcio-compiler` uses the features mechanism. default-features and features will not take effect because the patch dependency does not support this mechanism
   Compiling log v0.4.19
   Compiling env_logger v0.9.3
   Compiling bindgen v0.59.2
   Compiling grpcio-sys v0.12.1+1.46.5-patched (D:\repo\grpc-rs\grpc-sys)
error: failed to run custom build command for `grpcio-sys v0.12.1+1.46.5-patched (D:\repo\grpc-rs\grpc-sys)`

Caused by:
  process didn't exit successfully: `D:\repo\grpc-rs\target\debug\build\grpcio-sys-f7652c89275eba94\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=grpc_wrap.cc
  cargo:rerun-if-changed=grpc
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
  cargo:rerun-if-env-changed=GRPCIO_SYS_USE_PKG_CONFIG
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
  cargo:rerun-if-env-changed=CXX
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-pc-windows-msvc")
  HOST = Some("x86_64-pc-windows-msvc")
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-msvc
  CC_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_msvc
  CC_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-msvc
  CFLAGS_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_msvc
  CFLAGS_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  DEBUG = Some("true")
  cargo:rustc-link-search=native=D:\repo\grpc-rs\target\debug\build\libz-sys-b269dbf29ac1f639\out/build
  cargo:rustc-link-search=native=D:\repo\grpc-rs\target\debug\build\libz-sys-b269dbf29ac1f639\out/lib
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
  CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = Some("D:\\repo\\grpc-rs\\target\\debug\\build\\libz-sys-b269dbf29ac1f639\\out/build")
  CMAKE_x86_64-pc-windows-msvc = None
  CMAKE_x86_64_pc_windows_msvc = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "D:\\repo\\grpc-rs\\grpc-sys\\grpc" "-G" "Visual Studio 17 2022" "-Thost=x64" "-Ax64" "-DgRPC_INSTALL=false" "-DgRPC_BUILD_CSHARP_EXT=false" "-DgRPC_BUILD_CODEGEN=false" "-DgRPC_BENCHMARK_PROVIDER=none" "-DgRPC_ZLIB_PROVIDER=package" "-DCMAKE_INSTALL_PREFIX=D:\\repo\\grpc-rs\\target\\debug\\build\\grpcio-sys-89940f2ce5cf7f7e\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=Debug"
  -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
  -- The C compiler identification is MSVC 19.36.32535.0
  -- The CXX compiler identification is MSVC 19.36.32535.0

... skip a very long compile output ...

  running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\lib.exe" "-out:D:\\repo\\grpc-rs\\target\\debug\\build\\grpcio-sys-835316f67204394b\\out\\libgrpc_wrap.a" "-nologo" "D:\\repo\\grpc-rs\\target\\debug\\build\\grpcio-sys-835316f67204394b\\out\\grpc_wrap.o"
  exit code: 0
  cargo:rustc-link-search=native=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\lib\x64
  cargo:rustc-link-lib=static=grpc_wrap
  cargo:rustc-link-search=native=D:\repo\grpc-rs\target\debug\build\grpcio-sys-835316f67204394b\out
  cargo:rerun-if-env-changed=CXXSTDLIB_x86_64-pc-windows-msvc
  CXXSTDLIB_x86_64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CXXSTDLIB_x86_64_pc_windows_msvc
  CXXSTDLIB_x86_64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=HOST_CXXSTDLIB
  HOST_CXXSTDLIB = None
  cargo:rerun-if-env-changed=CXXSTDLIB
  CXXSTDLIB = None
  cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
  cargo:rerun-if-env-changed=TEST_BIND
  running grpc_wrap.cc --rust-target 1.47 --default-enum-style rust --constified-enum-module grpc_status_code --blocklist-type gpr_mu --blocklist-type gpr_cv --blocklist-type gpr_once --blocklist-function \bgpr_mu_.* --blocklist-function \bgpr_cv_.* --blocklist-function \bgpr_once_.* --blocklist-file ^/.* --allowlist-function \bgrpc_.* --allowlist-function \bgpr_.* --allowlist-function \bgrpcwrap_.* --allowlist-type \bgrpc_.* --allowlist-type \bgpr_.* --allowlist-type \bgrpcwrap_.* --allowlist-type \bcensus_context.* --allowlist-type \bverify_peer_options.* --allowlist-var \bGRPC_.* --no-layout-tests --impl-debug --no-derive-default --disable-header-comment --generate functions,types,vars,methods,constructors,destructors --size_t-is-usize -- -DGRPC_SYS_SECURE -D _WIN32_WINNT=0x600 -xc++ -I./grpc/include -std=c++11 -include ./grpc/include\grpc\compression.h -include ./grpc/include\grpc\grpc.h -include ./grpc/include\grpc\grpc_cronet.h -include ./grpc/include\grpc\grpc_posix.h -include ./grpc/include\grpc\grpc_security.h -include ./grpc/include\grpc\impl\codegen\byte_buffer.h -include ./grpc/include\grpc\impl\codegen\log.h -include ./grpc/include\grpc\impl\codegen\port_platform.h -include ./grpc/include\grpc\slice.h -include ./grpc/include\grpc\slice_buffer.h -include ./grpc/include\grpc\support\alloc.h -include ./grpc/include\grpc\support\cpu.h -include ./grpc/include\grpc\support\log_windows.h -include ./grpc/include\grpc\support\string_util.h -include ./grpc/include\grpc\support\sync.h -include ./grpc/include\grpc\support\thd_id.h -include ./grpc/include\grpc\support\time.h

  --- stderr
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_FLAGS
      CMAKE_ASM_FLAGS_DEBUG
      CMAKE_BUILD_TYPE

  CMake Warning at third_party/abseil-cpp/CMakeLists.txt:74 (message):
    A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake
    3.8 and up.  We recommend enabling this option to ensure your project still
    builds correctly.

  thread 'bindgen_grpc' panicked at 'called `Result::unwrap()` on an `Err` value: LexError { span: Span }', C:\Users\luofc\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bindgen-0.59.2\src\codegen\mod.rs:4577:66
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', grpc-sys\build.rs:486:14

System information