Skip to content

[DOCS] GC tutorial: wat2wasm and --invoke commands fail #316

Closed

Description

@Elvand-Lie

Description

The Garbage Collection tutorial cannot be completed by following its commands on Ubuntu 24.04. Both the compile instructions and the run commands fail.

The prerequisites install WABT with sudo apt install -y wabt. After copying the struct example into point.wat, the documented compile command fails:

$ wat2wasm point.wat -o point.wasm
point.wat:2:17: error: struct not allowed

The array example fails too:

$ wat2wasm array.wat -o array.wasm
array.wat:2:21: error: array type not allowed

These errors reproduce with Ubuntu's WABT 1.0.34 and upstream WABT 1.0.42. Adding GC feature flags does not make these examples compile. For example, WABT 1.0.42 with --enable-all reports:

point.wat:8:8: error: unexpected token "struct.new", expected an expr.

After compiling the same WAT with wasm-tools parse instead, the documented run commands fail on WasmEdge 0.18.1:

$ wasmedge --invoke make_point point.wasm
unknown option: invoke
$ wasmedge --invoke array_example array.wasm
unknown option: invoke

Both commands exit 1 rather than printing the documented 99 and 42.

Commands that complete the examples:

Step Current command Result Working replacement Result
Struct compilation wat2wasm point.wat -o point.wasm struct not allowed wasm-tools parse point.wat -o point.wasm Exit 0
Struct execution wasmedge --invoke make_point point.wasm unknown option: invoke wasmedge --reactor point.wasm make_point Exit 0, 99
Array compilation wat2wasm array.wat -o array.wasm array type not allowed wasm-tools parse array.wat -o array.wasm Exit 0
Array execution wasmedge --invoke array_example array.wasm unknown option: invoke wasmedge --reactor array.wasm array_example Exit 0, 42

The WAT and expected output can stay unchanged. The prerequisites need a compiler that supports the examples' GC syntax, such as wasm-tools.

Additional information

  • Docs commit: 510876021be352dbb19be5f44e4131343a4a32ba.
  • Clean ubuntu:24.04 container, Linux x86_64.
  • WABT 1.0.34 from apt and upstream WABT 1.0.42.
  • WasmEdge 0.18.1 installed using its official installer.
  • Replacement parser: wasm-tools 1.262.0.
  • Related: Feature Request: Add a chapter about the Wasm GC proposal #235 requests GC documentation. This issue concerns the existing tutorial's commands.

--invoke does not appear anywhere in the WasmEdge CLI's history; the CLI guide calls exported functions with wasmedge --reactor <module> <function>.

I have a fix ready and will open a PR.

Assisted by Claude Opus 5.5 and GPT 6.1 sol.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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