WASM Threads
I compiled a program with target: wasm32-wasip1-threads and -pthread support. However I get this error when trying to run:
wasm: TypeError: import wasi:thread-spawn must be an object (evaluating 'new WebAssembly.Instance(module, wasi.getImports(module))')
Has anyone managed to get pthreads on a-Shell working yet?
This error comes directly from Apple's webAssembly engine: it does not support threads (yet). To run a webassembly program with threads, we need two things: compiling it with the right target (as you did), and an engine that supports them (that's the blocking point). Safari does support webWorkers (since recently), so I think it should be able to support pthreads in the near future.
The Wasm threads feature is different from the WASI threads feature (wasm32-wasip1-threads).
Safari already supports Wasm threads. However, the current WASI implementations used in a-Shell (e.g., Wasmer JS, wasm3) don’t provide the WASI threads feature. Therefore, it’s not because of Safari.