You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been creating an empscripten WASM target for FastLED.
earlier this week today i've been intensively investigating symbols not showing up.
Let me just skip right to the point
Clang is stripping out your symbols before they are getting to the linker. Our exports were in one .cpp file.
Here's what's happening: clang is really aggressive in eliminating object files that aren't being referenced by other objects/libs (as of trzeci/emscripten:1.39.17-upstream).
EMSCRIPTEN_KEEPALIVE appears to be powerless here.. Telling the linker the symbols exist does nothing in orphaned object files. Clang will tree shake the exports out.
Here's a quick solution that worked for this project.
Put all your exports into a *.hpp.
Include this exports.hpp into one of your main cpp files.
Happy coding!
Repro Case
git clone github.com/fastled/fastled
Check out this commit.
5d0c06e3e8e2a6dc19b21263c2360839ac818c2c
Then run this command: uv run ci/wasm_compile.py -b examples/wasm
When the build is done a browser window will pop open and you'll see this, missing symbols for extern_setup and extern_loop:
Anytime after we applied the fix, you should see something like this:
I've been creating an empscripten WASM target for FastLED.
earlier this week today i've been intensively investigating symbols not showing up.
Let me just skip right to the point
Clang is stripping out your symbols before they are getting to the linker. Our exports were in one .cpp file.
Here's what's happening: clang is really aggressive in eliminating object files that aren't being referenced by other objects/libs (as of trzeci/emscripten:1.39.17-upstream).
EMSCRIPTEN_KEEPALIVE appears to be powerless here.. Telling the linker the symbols exist does nothing in orphaned object files. Clang will tree shake the exports out.
Here's a quick solution that worked for this project.
Happy coding!
Repro Case
git clone github.com/fastled/fastled
Check out this commit.
5d0c06e3e8e2a6dc19b21263c2360839ac818c2c
Then run this command:
uv run ci/wasm_compile.py -b examples/wasm
When the build is done a browser window will pop open and you'll see this, missing symbols for extern_setup and extern_loop:
Anytime after we applied the fix, you should see something like this:
Previous issue(s): #6233
The text was updated successfully, but these errors were encountered: