Skip to content

docs: fix gc tutorial compile and run commands - #317

Open
Elvand-Lie wants to merge 1 commit into
WasmEdge:mainfrom
Elvand-Lie:fix/gc-tutorial-commands
Open

Elvand-Lie wants to merge 1 commit into
WasmEdge:mainfrom
Elvand-Lie:fix/gc-tutorial-commands

Conversation

@Elvand-Lie

@Elvand-Lie Elvand-Lie commented Oct 24, 2026 •

Copy link
Copy Markdown

Explanation

Readers cannot finish either GC example: WABT rejects the GC WAT, and WasmEdge 0.18.1 rejects --invoke. Use wasm-tools to compile the unchanged WAT, then use the documented reactor invocation convention to obtain the existing expected outputs, 99 and 42.

Related issue

Closes #316

Related: #235 (GC documentation request).

What type of PR is this

/kind documentation

Proposed Changes

  • Replace the WABT prerequisite with wasm-tools, with a verified Linux x86_64 prebuilt installation and a macOS Homebrew command.
  • Link to the wasm-tools installation instructions for other platforms, including Linux aarch64.
  • Replace both compile commands with wasm-tools parse.
  • Put the module before its exported function and use --reactor in both run commands.
  • Preserve the WAT, expected output, installation-guide link, C API section and other wording. No translated gc.md exists under i18n/.
Step Before Before result After After result
Compile struct wat2wasm point.wat -o point.wasm struct not allowed wasm-tools parse point.wat -o point.wasm Exit 0
Run struct wasmedge --invoke make_point point.wasm unknown option: invoke wasmedge --reactor point.wasm make_point Exit 0, 99
Compile array wat2wasm array.wat -o array.wasm array type not allowed wasm-tools parse array.wat -o array.wasm Exit 0
Run array wasmedge --invoke array_example array.wasm unknown option: invoke wasmedge --reactor array.wasm array_example Exit 0, 42

Validation

Extracted the WAT and shell commands directly from the edited page and ran all eight Linux commands in order in a fresh ubuntu:24.04 container. WasmEdge 0.18.1 came from the official installer; wasm-tools 1.262.0 came from the documented release tarball. Both compile commands exited 0 and the run commands printed the documented results:

$ wasmedge --reactor point.wasm make_point
99
$ wasmedge --reactor array.wasm array_example
42

The unchanged disable-GC example was run verbatim with your_module.wasm holding a copy of point.wasm; it rejected the GC module as expected. Homebrew's formula API confirms an enabled, non-deprecated wasm-tools formula; the macOS command was not executed on Ubuntu.

The repository's npm run lint:ci passed under Node 16.14.0, but its ESLint and Stylelint file patterns do not cover Markdown.

Assisted by Claude Opus 5.5 and GPT 6.1 sol, reviewed by the author.

Use wasm-tools for GC WAT and the documented reactor invocation syntax.

Assisted-by: Codex (OpenAI)
Assisted-by: Claude (Anthropic)
Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
@Elvand-Lie
Elvand-Lie marked this pull request as ready for review October 24, 2026 16:51

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant