Skip to content

Fix Rust target triple mismatch in test_wit_deps targets #16

@avrabe

Description

@avrabe

Problem

Multiple Rust WebAssembly component *_host targets have target triple mismatch issues during CI builds, causing compilation failures across the codebase.

Errors

Linux:

error[E0461]: couldn't find crate `hello_component_bindings` with expected target triple x86_64-unknown-linux-gnu
 --> examples/basic/src/lib.rs:4:5
  |
4 | use hello_component_bindings::exports::hello::interfaces::greeting::Guest;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: the following crate versions were found:
          crate `hello_component_bindings`, target triple wasm32-wasip2

macOS:

error[E0461]: couldn't find crate `example_component_bindings` with expected target triple aarch64-apple-darwin
 --> examples/wasm_signing/src/lib.rs:7:5
  |
7 | use example_component_bindings::exports::example::signature::demo::{
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: the following crate versions were found:
          crate `example_component_bindings`, target triple wasm32-wasip2

Root Cause

Systematic cross-compilation configuration issue affecting all *_host targets where:

  • Host targets expect platform-specific triples (x86_64-unknown-linux-gnu, aarch64-apple-darwin)
  • Available crates are compiled for wasm32-wasip2
  • Rust toolchain configuration mismatch between host and WASM builds

Affected Targets

  • //test_wit_deps/consumer:consumer_component_wasm_lib_release_host
  • //examples/basic:hello_component_wasm_lib_release_host
  • //examples/wasm_signing:example_component_wasm_lib_release_host
  • Likely other *_host targets throughout the codebase

Current Workaround

Excluded all identified problematic *_host targets from CI builds on both Linux and macOS.

Proposed Solution

Fix Rust toolchain configuration for proper cross-compilation support:

  1. Review rust_wasm_component_bindgen rule implementation for host/WASM target handling
  2. Ensure proper Rust transitions for host vs WASM builds
  3. Configure dependency resolution to provide correct target triples
  4. May need separate binding generation for host vs WASM targets

Impact

  • Multiple test and example targets excluded from CI but core functionality works
  • Cross-compilation needs comprehensive fix for production use
  • Pattern suggests systematic issue in Rust WebAssembly component toolchain

Priority

Medium-High - affects multiple examples and tests, indicates broader toolchain issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions