diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2020-10-14 15:21:00 +0200 |
---|---|---|
committer | Jeff Vander Stoep <jeffv@google.com> | 2020-10-14 15:21:00 +0200 |
commit | 761577d44d5d8104fb718fbab47ca87353e75f9f (patch) | |
tree | 5647c69210cf8d9a287ac689476f45513371aefc /cross_compile.md | |
parent | 352363d43b57e1a7c239098b358919d113aeb81a (diff) | |
download | grpcio-761577d44d5d8104fb718fbab47ca87353e75f9f.tar.gz |
Import grpcio 0.6.0
And add metadata files using the following command:
get_rust_pkg.py --add3prf -v grpcio-0.6.0 -o grpcio
Test: none
Change-Id: I53cc0feb5c9d24eacb62331b968cab4ec85f60a6
Diffstat (limited to 'cross_compile.md')
-rw-r--r-- | cross_compile.md | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/cross_compile.md b/cross_compile.md new file mode 100644 index 0000000..67b1642 --- /dev/null +++ b/cross_compile.md @@ -0,0 +1,68 @@ +# Cross Compile gRPC-rs(0.2.1) to Windows under *nix + +## First you need to install mingw + +```bash +# macOS +brew install mingw-w64 + +# CentOS +yum install mingw64-openssl-static mingw64-zlib-static mingw64-winpthreads-static +``` + +## Fix CMake + +``` +# modify grpc-rs/grpc-sys/build.rs +# fix SYSTEM_PROCESSOR +"CMAKE_SYSTEM_PROCESSOR", get_env("CARGO_CFG_TARGET_ARCH").unwrap() +# fix try_run +"CMAKE_CROSSCOMPILING", "true" +``` + +### All diff in `fn build_grpc` + +```rust + let dst = { + let mut config = Config::new("grpc"); + if get_env("CARGO_CFG_TARGET_OS").map_or(false, |s| s == "macos") { + config.cxxflag("-stdlib=libc++"); + } + config + .define("CMAKE_SYSTEM_PROCESSOR", get_env("CARGO_CFG_TARGET_ARCH").unwrap()) + .define("CMAKE_CROSSCOMPILING", "true") + .build_target(library) + .uses_cxx11() + .build() + // config.build_target(library).uses_cxx11().build() + }; +``` + +### Fix find zlib + +```rust + // try these values + let mut zlib = "z"; + let mut zlib = "zlibstatic"; + let mut zlib = "zlibstaticd"; +``` + +## Fix WIN32 API + +``` +# grpc-rs/grpc-sys/grpc/CMakeLists.txt +# add these code after about line number 295 +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x600") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x600") +set(C_CXX_FLAGS "${C_CXX_FLAGS} -D_WIN32_WINNT=0x600") +``` + +## Fix boringssl + +Just update third_party/boringssl + +```bash +cd third_party/boringssl +git checkout master +git pull +``` |