Description
Hi,
I'm trying to build a library (which uses tikv-client as a dependency). I've attempted to compile this library on Windows (in Github Actions), Ubuntu (in Github Actions), and macOS (locally), none of which are working.
The issue that I have is that grpc-sys
is unable to build successfully.
On Windows I have tried with the default environment (which includes all of the necessary packages), and I have also installed the following packages just in case:
pacman --noconfirm -S mingw-w64-x86_64-yasm mingw-w64-clang-x86_64-clang mingw-w64-x86_64-binutils mingw-w64-x86_64-openssl
On Ubuntu I have installed:
sudo apt-get -y install mingw-w64
And on macOS I have installed:
brew install clang mingw-w64
In Github Actions, the tooling versions I am using are:
go version go1.17.12 windows/amd64
cargo 1.62.1 (a748cf5a3 2022-06-08)
rustc 1.62.1 (e092d0b6b 2022-07-16)
cmake version 3.23.3
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
There are two issues that I am encountering:
1. First issue
The build fails with:
C:/Users/runneradmin/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.8.1/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:451:26: error: 'numeric_limits' is not a member of 'std'
...
C:/Users/runneradmin/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.8.1/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:451:49: error: expected primary-expression before '>' token
...
C:/Users/runneradmin/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.8.1/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc:451:52: error: '::max' has not been declared; did you mean 'std::max'?
This error can be solved by editing the grpcio-sys-0.8.1/grpc/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc
and adding #include <limits>
towards the top. Currently tikv-client relies on [email protected] which relies on [email protected]. This issue has been fixed in the later versions of grpcio and grpcio-sys.
Is there a possibility of upgrading the grpcio dependency in tikv-client
?
2. Second issue
Once this issue is solved, we hit another issue. The build fails with:
././grpc/include/grpc/impl/codegen/port_platform.h:54:10: fatal error: 'windows.h' file not found
././grpc/include/grpc/impl/codegen/port_platform.h:54:10: fatal error: 'windows.h' file not found, err: true
thread 'main' panicked at 'Unable to generate grpc bindings: ()', /Users/tobie/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.8.1/build.rs:370:10
I am not too sure how to get around this issue. I have set the following in my .cargo/config.toml
file, but it does not change the outcome:
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
ar = "x86_64-w64-mingw32-gcc-ar"
Does anyone know a way of getting tikv-client and/or grpcio to build for x86_64-pc-windows-gnu
?