grpc-rs icon indicating copy to clipboard operation
grpc-rs copied to clipboard

Unable to build for x86_64-pc-windows-msvc or x86_64-pc-windows-gnu

Open tobiemh opened this issue 2 years ago • 0 comments

Describe the bug Hi, I'm trying to build a library which uses tikv/client-rust (which uses grpcio). I am using the master version of tikv-client which uses grpcio-sys 0.10.3+1.44.0-patched. I have attempted to build the library in a number of different ways:

  1. Build on macOS with x86_64-pc-windows-gnu as the target.
  2. Build on Github Actions (windows-latest) with the target x86_64-pc-windows-gnu.
  3. Build on Github Actions (windows-latest) with the target x86_64-pc-windows-msvc.

The tooling versions on macOS are:

brew install cmake mingw-w64
go version go1.19 darwin/arm64
cargo 1.62.1 (a748cf5a3 2022-06-08)
rustc 1.62.1 (e092d0b6b 2022-07-16)
cmake version 3.24.0
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
perl v5.30.3 built for darwin-thread-multi-2level

The tooling versions on Windows Github Actions are

go version go1.17.13 windows/amd64
cargo 1.62.1 (a748cf5a3 2022-06-08)
rustc 1.62.1 (e092d0b6b 2022-07-16)
cmake version 3.24.0
gcc.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 11.2.0
g++.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 11.2.0
perl v5.32.1 built for x86_64-msys-thread-multi

To Reproduce


When running the build on macOS I receive the following error:

error: couldn't read /Users/tobie/Repositories/surrealdb/target/x86_64-pc-windows-gnu/release/build/grpcio-sys-89eb569412f5ce5d/out/grpc-bindings.rs: No such file or directory (os error 2)
 --> /Users/tobie/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.10.3+1.44.0-patched/src/lib.rs:8:5
  |
8 |     include!(env!("BINDING_PATH"));
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `grpcio-sys` due to previous error

When running the build on Windows (for target x86_64-pc-windows-gnu) it errors with:

././grpc/include\grpc\impl\codegen\port_platform.h:68:10: fatal error: 'windows.h' file not found
././grpc/include\grpc\impl\codegen\port_platform.h:68:10: fatal error: 'windows.h' file not found, err: true
thread 'bindgen_grpc' panicked at 'Unable to generate grpc bindings: ()', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\grpcio-sys-0.10.3+1.44.0-patched\build.rs:440:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\grpcio-sys-0.10.3+1.44.0-patched\build.rs:484:14

The full build can be seen here: https://github.com/surrealdb/build/runs/7785309154


When running the build on Windows (for target x86_64-pc-windows-msvc) it errors with:

Error: could not find native static library `ssl`, perhaps an -L flag is missing?
error: could not compile `grpcio-sys` due to previous error

I have also attempted to install openssl headers with:

vcpkg integrate install
vcpkg install openssl:x64-windows-static
VCPKGRS_DYNAMIC: 1
LIBCLANG_PATH: 'C:\Program Files\LLVM\bin'
OPENSSL_DIR: C:\vcpkg\installed\x64-windows-static
OPENSSL_LIB_DIR: C:\vcpkg\installed\x64-windows-static\lib
OPENSSL_INCLUDE_DIR: C:\vcpkg\installed\x64-windows-static\include

The full build can be seen here: https://github.com/surrealdb/build/runs/7785309293


Expected behavior Expected the package grpcio-sys to build successfully.

Are there any instructions or guides to getting grpcio and grpcio-sys to build for the Windows target?

Thanks!

tobiemh avatar Aug 11 '22 12:08 tobiemh