Skip to content

gh-156780: Emscripten: add missing EM_JS_DEPS - #156798

Open
clementperon wants to merge 1 commit into
python:mainfrom
clementperon:emscripten-em-js-deps
Open

gh-156780: Emscripten: add missing EM_JS_DEPS#156798
clementperon wants to merge 1 commit into
python:mainfrom
clementperon:emscripten-em-js-deps

Conversation

@clementperon

@clementperon clementperon commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Split out of #156781, as suggested by @hoodmane.

EM_JS bodies are emitted verbatim, so Emscripten's dependency tracker cannot see the JS symbols they reference and silently omits them.

Declared here: $FS, $PATH, $FS_getMode, $resolveGlobalSymbol and emscripten_exit_with_live_runtime in emscripten_syscalls.c, and $wasmTable, $wasmMemory, $addFunction, $addOnPreRun in emscripten_trampoline.c.

No change for MAIN_MODULE builds. Without it, the link now fails with

error: undefined symbol: $resolveGlobalSymbol

instead of a ReferenceError during initRuntime.

@clementperon

Copy link
Copy Markdown
Contributor Author

@hoodmane first PR that add the EM_JS_DEPS() everywhere

Comment thread Misc/NEWS.d/next/Build/2026-09-01-23-32-01.gh-issue-156780.Kz8vQr.rst Outdated
EM_JS bodies are emitted verbatim, so Emscripten cannot see the JS symbols
they reference. Declare them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@freakboy3742

Copy link
Copy Markdown
Contributor

Noting that CI is currently failing because of a duplicated symbol; that seems to suggest there's a need to collate these declarations into a single coherent location so that we can avoid duplication, rather than co-locating them with usage.

Also - can I ask that you please don't force push. We don't care about a "messy" commit history; CPython uses merge commits, so any messy history isn't preserved after merge. Force pushes also mean that we can lose the context for review comments, and it's really easy to force push a merge comment that pings the entire core team for comment.

@hoodmane

hoodmane commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Emscripten's normal style guide is to put these next to the symbol that uses them so I think that's alright. I think we have a conflict with #156335, need to merge a main that includes that commit and fix the duplicate symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants