emscripten-core / emscripten-core/emscripten

[asyncify] EXPORT_ALL causes errors with _asyncify_start_unwind and O3

Open
#26,133 1 comment 1 reaction 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) 4.0.23 (7a5d93b50f6a3a35e85a0d2fc9e667b8498e6aed)
clang version 22.0.0git (https:/github.com/llvm/llvm-project 5243501cca02d7e54294d4bb5de0a85b06c40b7d)
Target: wasm32-unknown-emscripten
Thread model: posix
```

Reproduction is here: https://github.com/reeselevine/emscripten-bug-repro

To reproduce, compile using `make`, then run an http server, load `index.html` in the browser, then hit "Run Compute". An error with the following text will occur:

```
Error: RuntimeError: Aborted(TypeError: _asyncify_start_unwind is not a function). Build with -sASSERTIONS for more info.
```

This occurs in Chrome, Firefox, and Safari on my macOS system.

There are several ways to remove this error:

* Remove the `EXPORT_ALL` flag (since the necessary function is already in `EXPORTED_FUNCTIONS`).
* Reduce the optimization level from `O3` to `O2`
* Add the `ASSERTIONS` flag (which ironically is the recommended debugging step)

Either way, it seems like a bug that combining `EXPORT_ALL` and `O3` causes this error. Or at least, to me the documentation is not clear on how this would happen. I realize it's usually better to specify the `EXPORTED_FUNCTIONS`, but I would think `EXPORT_ALL` should still work.

I'm not sure if this is specifically an emscripten problem, or an emdawnwebgpu problem, or a combined issue. I'll note that this fails with using the most recent release of emdawnwebgpu as well (`v20260117.152313`) as a port.

Also, something else I just noticed as I was writing this report was that passing `--closure=1`, as. recommended in the Emdawnwebgpu docs, causes this example to seemingly always fail with this error: `main.js:1 Uncaught ReferenceError: Module is not defined` (in Chrome). Not sure if this means I'm doing something wrong in this build, or if this is a different/unrelated issue. A similar error shows up in Safari and Firefox.

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.