Skip to content

Fix build and tests for wasm32-wasip2 target#599

Merged
alexcrichton merged 1 commit intoWebAssembly:mainfrom
catamorphism:wasip2-build
Jul 29, 2025
Merged

Fix build and tests for wasm32-wasip2 target#599
alexcrichton merged 1 commit intoWebAssembly:mainfrom
catamorphism:wasip2-build

Conversation

@catamorphism
Copy link
Copy Markdown
Collaborator

Trying to build wasi-libc for the wasm32-wasip2 target and run the tests, I noticed a few issues:

  • TARGET_TRIPLE was being used before definition, in the definition of OBJDIR.
  • The ?= operator instead of = was being used to set TARGET_TRIPLE to wasm32-wasip2.
    This always left the target as wasm32-wasi, since it was defined to that in a previous line.
  • builtins wasn't being built by default, so building the tests would fail because it was unable to find libclang_rt.builtins.a.
  • make test didn't take theWASI_SNAPSHOT variable into consideration.
  • When building tests, clang --target=wasm32-wasip2 was building a P2 component,
    which caused the subsequent wasm-tools component new to fail because the input
    was already a component.

This PR fixes these issues. Now I'm able to run the tests with WASI_SNAPSHOT=p2.

Loading
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.

3 participants