GithubHelp home page GithubHelp logo

v8-rs's Introduction

V8-rs: An idiomatic Rust wrapper for the V8 Javascript engine

Rust bindings for v8 7.0, the JavaScript engine.

This is an attempt to rewrite the existing v8 crate to enable it to work with the latest version of V8. Hence, substantial portions of its code were used whenever possible.

Documentation

Use cargo doc --open. This is not on crates.io yet, since this is highly experimental, and an existing crate already exists with this name.

Requirements

  • Llatest nightly Rust.
  • Static libraries for V8 built with snapshot support and without i18n support for now, see V8's official build instructions. V8-sys will look for the necessary .libs to link against in the V8_LIBS environment variable if defined, or v8-sys's CARGO_MANIFEST_DIR/lib folder otherwise.
  • Place natives_blob.bin and snapshot_blob.bin next to executables (currently only main.rs) using this crate.

Installation

Clone from GitHub to obtain the latest development version, ensure you have V8 static libraries, then cargo build.

Hints for building V8 statically on Windows

Building on Windows is very frustrating due to some known bugs. Here's how to get a successful build.

  1. Follow the steps in the official documentation to check out the V8 repository and set up depot tools and other dependencies. The latest version of VS2017 works as well.

  2. Edit the args.gn file in the out.gn/x64-release folder so it contains the following:

is_debug = false
target_cpu = "x64"
is_component_build = false
v8_static_library = true
v8_enable_i18n_support=false
is_clang=false
use_lld = false
  1. Build the libraries for embedding with the following command:
ninja -C out.gn/x64.release v8

The official documentation suggests using the ninja -C out.gn/x64.release, which builds tests and fuzzers in addition to the libraries. Besides taking twice as long, the build fails due to unfixed bugs in the compilation of tests.

  1. You will need to place the following libraries from the build somewhere v8-sys can link against: inspector.lib, v8_base_0.lib, v8_base_1.lib, v8_external_snapshot.lib, v8_init.lib, v8_initializers.lib, v8_libbase.lib, v8_libplatform.lib and v8_libsampler.lib.

Also see How to build V8 on Windows and not go mad.

Generating the v8-sys bindings with bindgen

The optional feature "use-bindgen" generates the low level bindings using the included V8 headers (version 7.0), which requires bindgen to be installed. Generating this shouldn't be necessary in most cases, as the bindings have already been bundled with this crate.

v8-rs's People

Contributors

neurrone avatar

Stargazers

Hoang Phan avatar Thomas Hill avatar Dmitrii Vasilev avatar Stephen Belanger avatar Icemic avatar Matthias Neumann avatar Robert Krahn avatar Anton Whalley avatar Vlad avatar krircc avatar Jerome Gravel-Niquet avatar

Watchers

James Cloos avatar  avatar

v8-rs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.