denoland / rusty_v8

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

No binding built when using RUSTY_V8_ARCHIVE #1574

Closed ArchGuyWu closed 1 week ago

ArchGuyWu commented 1 month ago

Using RUSTY_V8_ARCHIVE just requires to specify the path to v8 static library, but rusty_v8 also requires prebuilt rusty_v8_src_binding.

  error: couldn't read C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.99.0\gen\src_binding_release_x86_64-pc-windows-gnu.rs: The system cannot find the file specified. (os error 2)
   --> C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\v8-0.99.0\src\binding.rs:4:1
    |
  4 | 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
devsnek commented 3 weeks ago

You can set RUSTY_V8_SRC_BINDING_PATH to the relevant file, which is available in the CI run that built that release: https://github.com/denoland/rusty_v8/actions/runs/10432771882#artifacts

I guess we could improve this by also including these files in the release artifacts

ArchGuyWu commented 3 weeks ago

You can set RUSTY_V8_SRC_BINDING_PATH to the relevant file, which is available in the CI run that built that release: https://github.com/denoland/rusty_v8/actions/runs/10432771882#artifacts

I guess we could improve this by also including these files in the release artifacts

Could we make rusty_v8 automatically obtain a binding if the RUSTY_V8_SRC_BINDING_PATH environment variable is not set? This is because it might be a custom static library.

devsnek commented 3 weeks ago

The binding file needs to be built under the same conditions that the static library was built. If you have your own process for building the static library, you will need to include the binding file in that workflow as well.

devsnek commented 1 week ago

The github releases now include the src_binding files as well.

GreenDou commented 1 week ago

You can set RUSTY_V8_SRC_BINDING_PATH to the relevant file, which is available in the CI run that built that release: https://github.com/denoland/rusty_v8/actions/runs/10432771882#artifacts

I guess we could improve this by also including these files in the release artifacts

Looks like RUSTY_V8_SRC_BINDING_PATH used in https://github.com/denoland/rusty_v8/blob/a97d89614e8249a86c223a2bc049b1c574bb40f1/src/binding.rs#L5 with includes! , and it can't be absolute path, so we cannot use an external src_binding file like what RUSTY_V8_ARCHIVE does?
Then how should we use the src_binding files from github releases?