rusty_v8 icon indicating copy to clipboard operation
rusty_v8 copied to clipboard

bindgen does not use downloaded chromium clang

Open AuTsing opened this issue 1 year ago • 4 comments

Since v0.95.0, a new feature #1507 has been merged. I got some errors when compiling v8.

Error message:

  ...
  ninja: Entering directory `/home/autsing/Gits/rusty_v8/target/debug/gn_out'
  ninja: no work to do.
  cargo:rustc-link-search=native=/home/autsing/Gits/rusty_v8/target/debug/gn_out/obj/
  cargo:rerun-if-env-changed=TARGET
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-changed=src/binding.hpp

  --- stderr
  thread 'main' panicked at /home/autsing/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/lib.rs:622:31:
  Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This error occurs in v8 build.rs running build_binding. I guess this is because bindgen denps on clang, but I haven't configured it.

My build host is WSL Ubuntu 22.04. My build steps are as follows:

  1. Install python, curl, libglib2.0-dev.
  2. Clone rusty_v8 repo.
  3. Run command V8_FROM_SOURCE=1 cargo build -vv.

This set of steps works before v0.94.0.

Acctually, I was able to build successfully in github action. So I think this may be caused by my environment not being configured. At first I wanted to build for Android, I encountered a problem that the header file could not be found. Then I tired build for x86_64-unknown-linux-gnu, I encountered the similar problem.

According to README:

The build depends on several binary tools: gn, ninja and clang. The tools will automatically be downloaded, if they are not detected in the environment.

Clang can be automatically downloaded and configured. Maybe the new version need to configure clang?

AuTsing avatar Aug 27 '24 16:08 AuTsing