Welcome to the Linux Foundation Forum!

Rust WebAssembly Host Runtimes - wasm3 bindgen compilation issue

Hello. I'm encountering an error in this section of the course:

  1. Using WebAssembly Host Runtimes
    Ways To Host WebAssembly Modules
    Creating a Wasm3 Host

If anyone can help me resolve it, it'd be much appreciated

I've installed clang with the following commands:

  1. sudo apt update
  2. sudo apt install clang

I get this error when I try to run the project:

  1. cargo run
  2. ...
  3. Compiling bindgen v0.59.2
  4. error: failed to run custom build command for `wasm3-sys v0.3.0`
  5.  
  6. Caused by:
  7. process didn't exit successfully: `rust-host/target/debug/build/wasm3-sys-5d19accd8ca6b736/build-script-build` (exit status: 101)
  8. --- stderr
  9. thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.59.2/src/ir/context.rs:878:9:
  10. "M3Global_union_(anonymous_at_wasm3/source/m3_env_h_131_5)" is not a valid Ident
  11. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here is my setup:
clang:
Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
rustc:
rustc 1.83.0 (90b35a623 2024-11-26)
cargo:
cargo 1.83.0 (5ffbef321 2024-10-29)
OS:
Ubuntu 24.04
x86_64 GNU/Linux (kernel 6.1.112+)

Here is my Cargo.toml

  1. [package]
  2. name = "rust-host"
  3. version = "0.1.0"
  4. edition = "2021"
  5.  
  6. [dependencies]
  7. wasm3 = { version = "0.3.0", features = ["build-bindgen"] }

This StackOverflow post mentions upgrading to bindgen 0.6.2 for Clang versions >= 16. But I'm not sure how I can do that as the build seems to be stuck on Bindgen v0.59.2. I'm quite new to Rust. If anyone can help solve this, it'd be great

Answers

  • Posts: 2

    One of the options mentioned in the StackOverflow post solved the issue - downgrading clang to version < 16 - allowed me to compile the wasm3-sys v0.3.0 dependency:

    1. sudo apt remove clang
    2. sudo apt clean && sudo apt autoremove
    3. sudo apt update
    4. sudo apt install clang-15

    I'd be interested to know if there is a way to get it to work without downgrading clang to <16, ie. force the use of a version of Bindgen ^v0.62.0

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training