Skip to content

Improve WASI support #898

@hyf0

Description

@hyf0

This is a followed up of #832.

With the hard work of @Brooooooklyn, we now are ok to compile to wasi successfully and run wasi rolldown successfully in some simple cases.

However, there are still a lot of hard and wired problems to be solved.

As #894 showed

  • In unbuntu
    • The wasi rolldown could compile the basic example successfully
    • Can't pass tests due to being hang while running
  • In windows/macos
    • Unsupported Operation error was throwed in rust even in the basic example case

Other problems

# Node.js wasi runtime has bug with `std::fs::read_link`
run: |
touch .npmrc
echo "node-linker=hoisted" >> .npmrc
pnpm install

#[cfg(target_family = "wasm")]
// if we don't perform this warmup, the following call to `std::fs` will stuck
if let Ok(_) = std::fs::metadata(std::env::current_dir()?) {};

Update: oh no! When set RUST_LOG=trace, pnpm --filter=@example/basic build success, fails if unset RUST_LOG, so strange! #898 (comment)

  1. Running a playground on the browser is blocked by: tokio: enable rt-multi-thread for wasm32-wasi-preview1-threads target tokio-rs/tokio#6510. Because the fs polyfill crosses the main thread/ web worker is using Atomic.wait, any std::fs operations within the async fn will block tokio current_thread runtime forever.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions