11/24/2024 Deno and v8

Discover rusty-v8.

Prerequisites : v8 build tools

rustup update

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
pip install jinja2

# get tools like gn, etc.
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=/path/to/depot_tools:$PATH

A way to check tools :

which python3 gn ninja clang

rusty-v8 and v8 build from source

git clone https://github.com/denoland/rusty_v8.git
cd rusty_v8

git submodule update --init --recursive

# takes > 20min
V8_FROM_SOURCE=1 cargo build -vv

# once done, you can test :
cargo run --example process -- ./examples/count-hosts.js

If you get such error :

error: couldn't read .../rusty_v8/gen/src_binding_release_aarch64-apple-darwin.rs: No such file or directory (os error 2)
 --> src/binding.rs:5:1
  |
5 | include!(env!("RUSTY_V8_SRC_BINDING_PATH"));
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `v8` (lib) due to 1 previous error

follow these steps :

mkdir gen
mv src_binding_release_aarch64-apple-darwin.rs gen/