emscripten-core / emscripten-core/emscripten

OPFS breaks with -pthread -sPROXY_TO_PTHREAD -sJSPI

Open
#27,620 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

**Version of emscripten/emsdk:**
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.8 (aeb67926e7de656da38bc807d83050af93578758)
clang version 24.0.0git (https:/github.com/llvm/llvm-project 4bfd08c2d769736841ae4f5705d76fa6daa39027)
Target: wasm32-unknown-emscripten
Thread model: posix

**Minimal reproducer**
```c
#include
#include
#include
#include

int main(void) {
printf("creating OPFS backend\n");
backend_t opfs = wasmfs_create_opfs_backend();
if (!opfs) {
printf("FAIL: no OPFS backend\n");
return 1;
}
printf("mounting /opfs ...\n");
if (wasmfs_create_directory("/opfs", 0777, opfs) != 0) {
printf("FAIL: could not mount /opfs\n");
return 1;
}
printf("PASS\n");
return 0;
}
```

**Build with**
`emcc minimal.c -o minimal.html -sWASMFS -pthread -sPROXY_TO_PTHREAD -sJSPI`

**Run with**
`emrun --browser chrome minimal.html`

**Expected**
It should print PASS.

**What actually happens**
Javascript error in the console:
```
Uncaught (in promise) SuspendError: trying to suspend without WebAssembly.promising
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.