rusty_v8 icon indicating copy to clipboard operation
rusty_v8 copied to clipboard

Custom Build Command for `rusty_v8` fails on Windows

Open sno2 opened this issue 4 years ago • 2 comments

Looks like the build.rs is failing on this unwrap which is called in this function.

PS C:\projects\rust\web_notifs\plugin> cargo clean  
PS C:\projects\rust\web_notifs\plugin> cargo build
   Compiling proc-macro2 v1.0.27
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.72
   Compiling autocfg v1.0.1
   Compiling winapi-x86_64-pc-windows-gnu v0.4.0
   Compiling winapi v0.3.9
   Compiling libc v0.2.94
   Compiling proc-macro-hack v0.5.19
   Compiling serde_derive v1.0.126
   Compiling futures-core v0.3.15
   Compiling either v1.6.1
   Compiling proc-macro-nested v0.1.7
   Compiling memchr v2.4.0
   Compiling futures-task v0.3.15
   Compiling futures-channel v0.3.15
   Compiling serde v1.0.126
   Compiling bitflags v1.2.1
   Compiling matches v0.1.8
   Compiling futures-sink v0.3.15
   Compiling unicode-xid v0.0.4
   Compiling tinyvec_macros v0.1.0
   Compiling pin-project-lite v0.2.6
   Compiling pin-utils v0.1.0
   Compiling futures-io v0.3.15
   Compiling slab v0.4.3
   Compiling quote v0.3.15
   Compiling ryu v1.0.5
   Compiling anyhow v1.0.40
   Compiling hashbrown v0.9.1
   Compiling serde_json v1.0.64
   Compiling bitflags v0.9.1
   Compiling percent-encoding v2.1.0
   Compiling log v0.4.14
   Compiling lazy_static v1.4.0
   Compiling strum v0.8.0
   Compiling itoa v0.4.7
   Compiling cfg-if v1.0.0
   Compiling futures-macro v0.3.15
   Compiling futures-util v0.3.15
   Compiling indexmap v1.6.2
   Compiling unicode-bidi v0.3.5
   Compiling tinyvec v1.2.0
   Compiling synom v0.11.3
   Compiling xml-rs v0.6.1
   Compiling form_urlencoded v1.0.1
   Compiling syn v0.11.11
   Compiling unicode-normalization v0.1.17
   Compiling which v4.1.0
   Compiling quote v1.0.9
   Compiling idna v0.2.3
   Compiling strum_macros v0.8.0
   Compiling fslock v0.1.6
   Compiling winrt v0.4.0
   Compiling rusty_v8 v0.22.2
error: failed to run custom build command for `rusty_v8 v0.22.2`

Caused by:
  process didn't exit successfully: `C:\projects\rust\web_notifs\plugin\target\debug\build\rusty_v8-542b4e71f5b65faa\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=src/binding.cc
  download lockfile: "C:\\projects\\rust\\web_notifs\\plugin\\target\\debug\\build\\lib_download.fslock"
  static lib URL: C:\Program Files\rusty_v8/v0.22.2/rusty_v8_release_x86_64-pc-windows-gnu.lib
  cargo:rustc-link-search=C:\projects\rust\web_notifs\plugin\target\debug\gn_out\obj

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 3, kind: NotFound, message: "The 
system cannot find the path specified." }', C:\Users\carte\.cargo\registry\src\github.com-1ecc6299db9ec823\rusty_v8-0.22.2\build.rs:253:30
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

sno2 avatar May 20 '21 22:05 sno2

I'm trying to build rusty_v8 on my Windows machine and I see an error also:

❯ cargo build
warning: C:\Users\duncan\git\rusty_v8\Cargo.toml: file found to be present in multiple build targets: C:\Users\duncan\git\rusty_v8\build.rs
   Compiling winapi v0.3.9
   Compiling libc v0.2.126
   Compiling either v1.6.1
   Compiling lazy_static v1.4.0
   Compiling bitflags v1.3.2
   Compiling which v4.2.5
   Compiling fslock v0.1.8
   Compiling v8 v0.48.0 (C:\Users\duncan\git\rusty_v8)
The following warnings were emitted during compilation:

warning: Not using sccache or ccache

error: failed to run custom build command for `v8 v0.48.0 (C:\Users\duncan\git\rusty_v8)`

Caused by:
  process didn't exit successfully: `C:\Users\duncan\git\rusty_v8\target\debug\build\v8-409758ad5f2fdb06\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=.gn
  cargo:rerun-if-changed=BUILD.gn
  cargo:rerun-if-changed=src/binding.cc
  cargo:rerun-if-env-changed=CCACHE
  cargo:rerun-if-env-changed=CLANG_BASE_PATH
  cargo:rerun-if-env-changed=DENO_TRYBUILD
  cargo:rerun-if-env-changed=DOCS_RS
  cargo:rerun-if-env-changed=GN
  cargo:rerun-if-env-changed=GN_ARGS
  cargo:rerun-if-env-changed=HOST
  cargo:rerun-if-env-changed=NINJA
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-env-changed=RUSTY_V8_ARCHIVE
  cargo:rerun-if-env-changed=RUSTY_V8_MIRROR
  cargo:rerun-if-env-changed=SCCACHE
  cargo:rerun-if-env-changed=V8_FORCE_DEBUG
  cargo:rerun-if-env-changed=V8_FROM_SOURCE
  cargo:rustc-link-lib=static=rusty_v8
  cargo:rustc-link-lib=dylib=winmm
  cargo:rustc-link-lib=dylib=dbghelp
  cargo:rustc-link-lib=dylib=msvcprt
  Downloading https://github.com/denoland/ninja_gn_binaries/archive/20220517.tar.gz... Done.
  using Chromiums clang
  clang_base_path C:\Users\duncan\git\rusty_v8\target\debug\clang
  Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Win/clang-llvmorg-15-init-9576-g75f9e83a-3.tgz .......... Done.
  cargo:warning=Not using sccache or ccache
  The current directory is C:\Users\duncan\git\rusty_v8
  gn gen --root=C:\Users\duncan\git\rusty_v8 C:\Users\duncan\git\rusty_v8\target\debug\gn_out
  common/icudtl.dat
  ERROR at //build/toolchain/win/toolchain.gni:51:28: Assignment had no effect.
        toolchain_is_clang = toolchain_args.is_clang
                             ^----------------------
  You set the variable "toolchain_is_clang" here and it was unused before it went
  out of scope.
  See //build/toolchain/win/toolchain.gni:554:3: whence it was called.
    msvc_toolchain(clang_toolchain_prefix + target_name) {
    ^------------------------------------------------------
  See //build/toolchain/win/BUILD.gn:34:3: whence it was called.
    win_toolchains("x86") {
    ^-----------------------
  See //BUILD.gn:4:1: which caused the file to be included.
  static_library("rusty_v8") {
  ^----------------------------

  --- stderr
  thread 'main' panicked at 'assertion failed: Command::new(gn()).arg(format!(\"--root={}\",\n
                  dirs.root.display())).arg(\"gen\").arg(&gn_out_dir).arg(\"--args=\".to_owned()\n
          +\n                                &args).stdout(Stdio::inherit()).stderr(Stdio::inherit()).envs(env::vars()).status().unwrap().success()', build.rs:670:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

duncanmak avatar Aug 16 '22 02:08 duncanmak

I was running into the same issue on Ubuntu. Do you have python in your path like the READme describes? I am running into the same issue and when I do a which python in my terminal I do not have anything in my path. Currently I am using Ubuntu on WSL2 for Windows 11.

    assert!(Command::new("python")
      .arg("./tools/ninja_gn_binaries.py")
      .arg("--dir")
      .arg(&target_dir)
      .status()
      .unwrap()
      .success());

ghost avatar Nov 26 '22 13:11 ghost