Skip to content

"WASM module load failed: zero byte expected" error when running modules compiled from Rust #4289

Closed
@alepvn33

Description

@alepvn33

Thanks for filing a bug or defect report! Please fill out the TODOs below.

Subject of the issue

I am getting an error when running any WASM module compiled from Rust with wasm32-wasip1 or wasm32-unknown-unknown targets.
Not even an helloworld works. I use a simple cargo build --target=wasm32-wasip1 or cargo build --target=wasm32-unknown-unknown command to compile.

I am getting "WASM module load failed: zero byte expected".

I am running on Linux, iwasm version is 2.1.0.

Does anyone know which is the cause?

Thanks!

Test case

fn main() {
    println!("Hello, world!");
}

Your environment

WAMR:

  • Host OS: Linux
  • WAMR version: iwasm 2.1.0
  • platform: x86_64-unknown-linux-gnu
  • cpu architecture: x86_64
  • running mode: interpreter mode
    Compiler:
  • rustc 1.85.0 (4d91de4e4 2025-02-17)
  • commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
  • commit-date: 2025-02-17
  • host: x86_64-unknown-linux-gnu
  • release: 1.85.0
  • LLVM version: 19.1.7

Steps to reproduce

Compile with cargo build --target=wasm32-wasip1 or cargo build --target=wasm32-unknown-unknown, then run iwasm target/wasm32-wasip1/debug/hello_wasi.wasm

Expected behavior

Printing of the "Hello, World!" string.

Actual behavior

An error is yielded: "WASM module load failed: zero byte expected"

Extra Info

It works fine with modules compiled from C.

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