Cores not exporting as ES6 Module when compiled with Emscripten to WebAssembly
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 14.1k
- Forks
- 2.2k
- Avg merge
- 7h 35m
- Merged PRs (30d)
- 51
Description
Where do you define options for Emscripten such as -s EXPORT_ES6=1 and -s MODULARIZE=1 for the final WASM/JS output of dist-cores.sh? I've defined them here: https://github.com/libretro/RetroArch/blob/master/Makefile.emscripten#L9
But the final output JS still does not export ES6 modules, causing you to use very legacy style 1990's style script tags instead of module loading, not properly supporting async, and I get these compiler warnings during linking:
CC gfx/video_filters/phosphor2x.c
emcc: warning: linker setting ignored during compilation: 'EXPORTED_FUNCTIONS' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'ALLOW_MEMORY_GROWTH' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'EXPORTED_RUNTIME_METHODS' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'EXPORT_ES6' [-Wunused-command-line-argument]
emcc: warning: linker setting ignored during compilation: 'MODULARIZE' [-Wunused-command-line-argument]
Flag here: https://github.com/emscripten-core/emscripten/blob/main/src/settings.js#L1176
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with dist-cores.sh and Makefile.emscripten, then trace where the final Emscripten link command is assembled. Review the reported linker warnings and verify how EXPORT_ES6 and MODULARIZE reach the final WASM/JS output. Done means the generated JavaScript exports as an ES6 module and the warnings no longer occur during linking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, shell, wasm
- Domain
- build-system, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100