Swoorup / dgraph-rs

A dgraph client driver written in rust ⛺
https://crates.io/crates/dgraph
MIT License
98 stars 10 forks source link

Remove generating of source files from build step #2

Closed ondrowan closed 5 years ago

ondrowan commented 5 years ago

This wasn't as easy as I expected. It seems it's a bit tricky to run scripts using cargo, but I've found this SO question and chose #2 from accepted answer. It's not ideal, but it does the job.

On top of that, for some reason, after first time I generated source files using protoc on Windows, it kept hanging on subsequent runs. Haven't figured out why and I'm not sure if it has something to do with this change.

Fixes #1

Swoorup commented 5 years ago

Appreciate the pull request. I quickly tested the branch, it appears to be failing when building grpcio-sys using cargo build:

   Compiling rand_isaac v0.1.1
   Compiling quote v0.6.12
   Compiling grpcio-sys v0.4.4
error: failed to run custom build command for `grpcio-sys v0.4.4`
process didn't exit successfully: `C:\Users\swoor\github\dgraph-rs\target\debug\build\grpcio-sys-b0d8ed265d940715\build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=grpc_wrap.cc
cargo:rerun-if-changed=grpc
cargo:rerun-if-env-changed=GRPCIO_SYS_USE_PKG_CONFIG
cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS
running: "cmake" "C:\\Users\\swoor\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\grpcio-sys-0.4.4\\grpc" "-G" "Visual Studio 16 2019" "-Thost=x64" "-Ax64" "-DgRPC_INSTALL=false" "-DgRPC_BUILD_CSHARP_EXT=false" "-DgRPC_BUILD_CODEGEN=false" "-DgRPC_BENCHMARK_PROVIDER=none" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\swoor\\github\\dgraph-rs\\target\\debug\\build\\grpcio-sys-d7d3405258d8f7ff\\out" "-DCMAKE_C_FLAGS= /nologo /MD" "-DCMAKE_C_FLAGS_DEBUG= /nologo /MD" "-DCMAKE_CXX_FLAGS= /nologo /MD" "-DCMAKE_CXX_FLAGS_DEBUG= /nologo /MD" "-DCMAKE_BUILD_TYPE=Debug"
-- Configuring incomplete, errors occurred!
See also "C:/Users/swoor/github/dgraph-rs/target/debug/build/grpcio-sys-d7d3405258d8f7ff/out/build/CMakeFiles/CMakeOutput.log".

--- stderr
CMake Error at CMakeLists.txt:31 (project):
  Generator

    Visual Studio 16 2019

  could not find any instance of Visual Studio.

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', C:\Users\swoor\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.39\src\lib.rs:829:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

I'll have a bit more time to look into this weekend. #2 sounds like a reasonable approach.

ondrowan commented 5 years ago

I just tried it on both Windows 10 and MacOS, and both builds were successful (although grpcio-sys takes ages to build). Do you have Visual Studio installed? I think it needs its compiler to build the package.

I checked and Travis has Windows support as well. It'd be probably worth it to add it to build pipeline. I can look at it during the weekend.

Swoorup commented 5 years ago

Looks like an issue with new visual studio 2019, not working with it. Looks to be working with the old version.