denoland / rusty_v8

Rust bindings for the V8 JavaScript engine
https://crates.io/crates/v8
MIT License
3.13k stars 300 forks source link

rust_v8 0.98.0,0.99.0 build failure #1541

Closed chenrui333 closed 1 month ago

chenrui333 commented 1 month ago

👋 while running deno 1.45.3 build, found some build failure as below:

    --- stderr
    thread 'main' panicked at /tmp/deno-20240723-18844-vtv80a/rusty_v8/build.rs:330:3:
    assertion failed: Command::new(gn()).arg(format!("--script-executable={}",
                                    python())).arg("args").arg(gn_out_dir).arg("--list").status().unwrap().success()
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/10058665735/job/27807237240?pr=178170 relates to https://github.com/Homebrew/homebrew-core/pull/178170

devsnek commented 1 month ago

Are you able to get the stdout/stderr from the command failure?

chenrui333 commented 1 month ago

still seeing the same error log in the 0.99.0 release build, how should I get the stdout/stderr logs?

    --- stderr
    thread 'main' panicked at /tmp/deno-20240727-18802-qz1dny/rusty_v8/build.rs:330:3:
    assertion failed: Command::new(gn()).arg(format!("--script-executable={}",
                                    python())).arg("args").arg(gn_out_dir).arg("--list").status().unwrap().success()
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  error: failed to compile `deno v1.45.4 (/tmp/deno-20240727-18802-qz1dny/deno/cli)`, intermediate artifacts can be found at `/tmp/deno-20240727-18802-qz1dny/deno/target`.
  To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

relates to https://github.com/Homebrew/homebrew-core/pull/178635

devsnek commented 1 month ago

I think you can change this code:

assert!(Command::new(gn()).arg(format!("--script-executable={}", python())).arg("args").arg(gn_out_dir).arg("--list").status().unwrap().success());

to something like

let output = Command::new(gn()).arg(format!("--script-executable={}", python())).arg("args").arg(gn_out_dir).arg("--list").output().unwrap();
std::io::stderr().write_all(&output.stdout).unwrap();
std::io::stderr().write_all(&output.stderr).unwrap();
assert!(output.status.success());

If there's a way to reproduce the homebrew build locally I can also try to debug it at some point.

chenrui333 commented 1 month ago

you can download https://raw.githubusercontent.com/Homebrew/homebrew-core/f1dfb9ef2aa27c6767f26ee10d07158a5cc435d9/Formula/d/deno.rb and run brew install -f /path/to/deno.rb

devsnek commented 1 month ago

@chenrui333 sorry i'm getting this

==> Pouring deno--1.45.4.x86_64_linux.bottle.tar.gz
cp: cannot create regular file '/home/linuxbrew/.linuxbrew/Cellar/deno/./1.45.2/bin/deno': Permission denied
cp: cannot create regular file '/home/linuxbrew/.linuxbrew/Cellar/deno/./1.45.2/bin/denort': Permission denied
Error: Failure while executing; `/usr/bin/env cp -pR /tmp/homebrew-unpack20240727-18829-1m5dz1/deno/. /home/linuxbrew/.linuxbrew/Cellar/deno` exited with 1. Here's the output:
cp: cannot create regular file '/home/linuxbrew/.linuxbrew/Cellar/deno/./1.45.2/bin/deno': Permission denied
cp: cannot create regular file '/home/linuxbrew/.linuxbrew/Cellar/deno/./1.45.2/bin/denort': Permission denied
devsnek commented 1 month ago

Ok fixed the above, turns out the needed command is brew install --build-from-source ./deno.rb. I can reproduce the issue now. Would be helpful if brew didn't delete everything after the build failed...

pedro-w commented 1 month ago

Would be helpful if brew didn't delete everything after the build failed...

Does --keep-tmp help? (https://docs.brew.sh/Manpage#commands)

chenrui333 commented 1 month ago

Would be helpful if brew didn't delete everything after the build failed...

I can actually dump out the docs from CI runner, is that good?

devsnek commented 1 month ago

@chenrui333 --keep-tmp worked, but I can't reproduce this manually running build commands in the directory, only under brew install --build-from-source. So it seems like an issue with how brew is putting things together, but I don't know anything about brew, so a brew developer probably needs to take a look.

devsnek commented 1 month ago

@chenrui333 can you try setting NO_PRINT_GN_ARGS=1 when building? I think that might fix it.

chenrui333 commented 1 month ago

yeah, totally.

chenrui333 commented 1 month ago

somehow it builds fine now 😓

chenrui333 commented 1 month ago

since I can no longer reproduce this issue, gonna close it now. Thanks!