This is my build script. cargo build
build and generates the bindings.
extern crate bindgen;
use std::env;
use std::path::PathBuf;
fn main() {
println!("cargo:rustc-link-lib=libv8");
let bindings = bindgen::Builder::default()
.header("wrapper.hpp")
.enable_cxx_namespaces()
.generate()
.expect("Could not generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings.write_to_file(out_path.join("bindings.rs"))
.expect("Could not write bindings");
}
But when I cargo test
, it gives the following error:
error: linking with cc failed: exit code: 1
note: /usr/bin/ld: cannot find -llibv8