Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo build failed on Windows 10 #48

Closed
IntelMin opened this issue Mar 28, 2022 · 6 comments
Closed

cargo build failed on Windows 10 #48

IntelMin opened this issue Mar 28, 2022 · 6 comments

Comments

@IntelMin
Copy link

Having the following issue while cargo install:

error: failed to run custom build command for `hotg-runecoral v0.3.10`

Caused by:
  process didn't exit successfully: `C:\Users\Intel\AppData\Local\Temp\cargo-installShKHE4\release\build\hotg-runecoral-9c87cb88ab6a269a\build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }', C:\Users\Intel\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\hotg-runecoral-0.3.10\build.rs:80:22
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `hotg-rune-cli v0.11.3`, intermediate artifacts can be found at `C:\Users\Intel\AppData\Local\Temp\cargo-installShKHE4`

Caused by:
  build failed
@Michael-F-Bryan
Copy link

Can you re-run the build with RUST_BACKTRACE=1 so we can see a stacktrace?

Based on the error message I'm guessing it is trying to run a program that isn't installed, probably Bazel.

@saidinesh5
Copy link
Collaborator

Hi, Are you on Windows 10 ?

Can you double check all these dependencies are installed for you?

  • Visual Studio Build tools 2019
  • Msys2
  • choco install python llvm bazel
  • pip install numpy
  • rust

On Windows compilation is a little more tricky due to the path size limits ( bazelbuild/bazel#5163 ).
How we workaround this in CI and in local development is by manually building librunecoral first in some location like C:\src\

          mkdir -p dist/include
          mkdir -p dist/lib/windows/x86_64/
          bazel build --config windows //runecoral:runecoral
          cp runecoral/runecoral.h dist/include
          cp bazel-bin/runecoral/runecoral.lib dist/lib/windows/x86_64/

And then setting RUNECORAL_DIST_DIR environment variable to point to that dist dir while compiling rune

@IntelMin
Copy link
Author

Installing Bazel fixed that issue, but still having another issue:

 ERROR: C:/librunecoral/WORKSPACE:72:23: fetching android_ndk_repository rule //external:androidndk: Either the path attribute of android_ndk_repository or the ANDROID_NDK_HOME environment variable must be set.
INFO: Repository go_sdk instantiated at:
  C:/librunecoral/WORKSPACE:30:14: in <toplevel>
  C:/users/intel/_bazel_intel/ebrudqsq/external/org_tensorflow/tensorflow/workspace0.bzl:120:20: in workspace
  C:/users/intel/_bazel_intel/ebrudqsq/external/com_github_grpc_grpc/bazel/grpc_extra_deps.bzl:36:27: in grpc_extra_deps
  C:/users/intel/_bazel_intel/ebrudqsq/external/io_bazel_rules_go/go/toolchain/toolchains.bzl:379:28: in go_register_toolchains
  C:/users/intel/_bazel_intel/ebrudqsq/external/io_bazel_rules_go/go/private/sdk.bzl:65:21: in go_download_sdk
Repository rule _go_download_sdk defined at:
  C:/users/intel/_bazel_intel/ebrudqsq/external/io_bazel_rules_go/go/private/sdk.bzl:53:35: in <toplevel>
ERROR: Analysis of target '//runecoral:runecoral' failed; build aborted: Either the path attribute of android_ndk_repository or the ANDROID_NDK_HOME environment variable must be set.
INFO: Elapsed time: 2129.796s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (7 packages loaded, 11 targets configured)
    currently loading: @bazel_tools//tools/jdk
    Fetching @local_execution_config_python; fetching
    Fetching @local_config_python; Restarting.
    Fetching ...docker; Cloning 9bfcd7dbf0294ed9d11a99da6363fc28df904502 of https://github.com/bazelbuild/rules_docker\
.git
    Fetching https://dl.google.com/go/go1.12.5.windows-amd64.zip

Does it require android ndk as well?

@IntelMin
Copy link
Author

Hi, Are you on Windows 10 ?

Can you double check all these dependencies are installed for you?

  • Visual Studio Build tools 2019
  • Msys2
  • choco install python llvm bazel
  • pip install numpy
  • rust

On Windows compilation is a little more tricky due to the path size limits ( bazelbuild/bazel#5163 ). How we workaround this in CI and in local development is by manually building librunecoral first in some location like C:\src\

          mkdir -p dist/include
          mkdir -p dist/lib/windows/x86_64/
          bazel build --config windows //runecoral:runecoral
          cp runecoral/runecoral.h dist/include
          cp bazel-bin/runecoral/runecoral.lib dist/lib/windows/x86_64/

And then setting RUNECORAL_DIST_DIR environment variable to point to that dist dir while compiling rune

Installed all dependencies mentioned above, but still having issue with Android NDK.
I can not find any instruction about Android NDK in docs.

@saidinesh5
Copy link
Collaborator

Ahh I think that's an issue with newer version of bazel. It looks for ANDROID_NDK because we have https://github.com/hotg-ai/librunecoral/blob/master/WORKSPACE#L72 this line. just comment that out and you can build for windows.

I will fix this issue later properly

@IntelMin
Copy link
Author

Thanks for commenting.
Anyway, I fixed that issue by setting ANDROID_NDK_HOME system path to my local ndk directory.

Finally, it builds successfully and I am ready to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants