Repository navigation
Closed
Labels
bugSomething isn't working
Description
🐛 Bug
pyodide.asm.js:10 Pyodide has suffered a fatal error. Please report this to the Pyodide maintainers.
pyodide.asm.js:10 The cause of the fatal error was:
pyodide.asm.js:10 TypeError: getWasmTableEntry(...) is not a function
at invoke_ii (pyodide.asm.js:10:1544237)
at 00bcba5a:0x54516
at invoke_viiiiiiiiiiiiiii (pyodide.asm.js:10:1548668)
at 00bcba5a:0x414a2
at invoke_viii (pyodide.asm.js:10:1545014)
at 00bcba5a:0x56286
at method_call_trampoline (pyodide.asm.js:10:216572)
at pyodide.asm.wasm:0x162162
at method_call_trampoline (pyodide.asm.js:10:216572)
at pyodide.asm.wasm:0x126317
API.fatal_error @ pyodide.asm.js:10
Module.callPyObjectKwargs @ pyodide.asm.js:10
Module.callPyObject @ pyodide.asm.js:10
apply @ pyodide.asm.js:10
apply @ pyodide.asm.js:10
runPython @ pyodide.asm.js:10
main @ (index):15
await in main (async)
(anonymous) @ (index):22
pyodide.asm.js:10 Stack (most recent call first):
pyodide.asm.js:10 File "<exec>", line 5 in <module>
pyodide.asm.js:10 File "/lib/python3.10/site-packages/_pyodide/_base.py", line 304 in run
pyodide.asm.js:10 File "/lib/python3.10/site-packages/_pyodide/_base.py", line 435 in eval_code
(index):21 Uncaught (in promise) TypeError: getWasmTableEntry(...) is not a function
at invoke_ii (pyodide.asm.js:10:1544237)
at 00bcba5a:0x54516
at invoke_viiiiiiiiiiiiiii (pyodide.asm.js:10:1548668)
at 00bcba5a:0x414a2
at invoke_viii (pyodide.asm.js:10:1545014)
at 00bcba5a:0x56286
at method_call_trampoline (pyodide.asm.js:10:216572)
at pyodide.asm.wasm:0x162162
at method_call_trampoline (pyodide.asm.js:10:216572)
at pyodide.asm.wasm:0x126317
To Reproduce
- First install the maturin beta version:
pip install -U --pre maturin - Build with maturin:
RUSTUP_TOOLCHAIN=nightly maturin build -o dist --release --target wasm32-unknown-emscripten - Run
./scripts/start_serverand openhttp://localhost:8000in browser, see the error in console.
Expected behavior
No TypeError: getWasmTableEntry(...) is not a function in console.
Environment
- Pyodide Version: 0.21.0
- Browser version: 104.0.5112.79
- Any other relevant information:
Additional context
Reacted by Mike Ritchie
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
messense commentedon Aug 13, 2022
I do see
getWasmTableEntryfunction in minifiedpyodide.asm.js, kinda odd.Further debugging shows that
getWasmTableEntry(0)returnednullsogetWasmTableEntry(0)(a1)throwsTypeError: getWasmTableEntry(...) is not a functionUse a debug build of the wheel shows a different error
Patch https://github.com/kitao/pyxel/blob/30bb7b5e087408ed3737ab1e7e224bf9bb3f789d/crates/pyxel-engine/src/platform_sdl2.rs#L59-L60 to
let scale = get_scale(width, height);reverts back to the originalTypeError: getWasmTableEntry(...) is not a functionerrorryanking13 commentedon Aug 13, 2022
Thanks for the report, @messense. I can reproduce the error.
For those who want to quickly reproduce the error, here is the wheel of pyxel (compressed due to Github limitation).
pyxel-1.8.0-cp37-abi3-emscripten_3_1_14_wasm32.zip
hoodmane commentedon Aug 13, 2022
What happens if you build with
panic=abort?messense commentedon Aug 13, 2022
@hoodmane With
panic=aborthoodmane commentedon Aug 13, 2022
Looks like progress. We should patch library_dylink to report the name of the missing symbols so that we can get better error messages in this case. We can probably contribute such a change to emscripten.
messense commentedon Aug 14, 2022
Add a conditional breakpoint shows that the missing symbols is
SDL_GetDesktopDisplayMode, seems like SDL2 isn't properly linked? I don't know much about linking in Emscripten, not sure what went wrong.km19809 commentedon Aug 15, 2022
I thought the linking error occurred because LLVM version mismatch.
Emscripten 3.1.14 uses LLVM 15, but rustc 1.65.0-nightly (latest) uses LLVM 14.
However, when I downgraded pyodide to 0.20.0 and emscripten 2.0.27 (which uses LLVM 14) , it threw the following error:

So I was not able to find out whether the LLVM version matters.
To reproduce:
I built it using
RUSTUP_TOOLCHAIN=nightly maturin build -o dist --release --target wasm32-unknown-emscripten -- -C target-feature=+mutable-globals, with rustc 1.65.0-nightly.And I used
pyodide.loadPackageto load the emscripten wheel. (Due to the limitation of pyodide 0.20.0)hoodmane commentedon Aug 15, 2022
Probably the issue is that we aren't linking SDL into Pyodide?
messense commentedon Aug 15, 2022
OK, I've just read the Dynamic Linking documentation of Emscripten now. In this case I think Pyodide is the main module and pyxel is the side module, because only main module has system libraries linked in, in order to make it work we need to link SDL into Pyodide, right?
@hoodmane Do we have an easy way to do a customized Pyodide build with SDL2 linked in?
km19809 commentedon Aug 15, 2022
There is a closed issue that seems related to this.
#1657 (comment)
Should I rebuild pyodide with modified
MAIN_MODULE_LDFLAGSin Makefile.envs?messense commentedon Aug 15, 2022
I guess another option is to statically link SDL2 in pyxel? See https://github.com/Rust-SDL2/rust-sdl2#bundled-feature and https://github.com/Rust-SDL2/rust-sdl2#static-linking-in-linux, I haven't tried so not sure whether it will build or not for
wasm32-unknown-emscriptentarget.hoodmane commentedon Aug 15, 2022
Yes. You need to add
-sUSE_SDL=2to theMAIN_MODULE_LDFLAGS.This is not possible because SDL2 is implemented in Javascript and Emscripten does not currently allow dynamically loading Javascript.
km19809 commentedon Aug 15, 2022
I rebuilt pyodide with

-sUSE_SDL=2, then the message changed:I assumed this is related to a canvas issue(emscripten-ports/SDL2#130),
so I added a blank canvas with id "canvas":
Then the error changed:

Although it crashes, the initial linking issue seems to be resolved.
messense commentedon Aug 15, 2022
@km19809 Can you upload the built
pyodide.jssomewhere?km19809 commentedon Aug 15, 2022
@messense
Dropbox
I think this issue is resolved, but I post the link here as a (potential) conclusion.
hoodmane commentedon Aug 15, 2022
I think setting
-sGL_WORKAROUND_SAFARI_GETCONTEXT_BUG=0would fix the most recent error.You may also want
-sMAX_WEBGL_VERSION=2.messense commentedon Aug 15, 2022
Thanks for the help!
hoodmane commentedon Aug 15, 2022
Please don't hesitate to open a follow up issue if you can't figure out how to get it working.
km19809 commentedon Aug 15, 2022
This resolved SafariWebGL2 issue. (It still crashes though 😂)
Thank you a lot!
henryiii commentedon May 31, 2024
Using the new cibuildwheel support, both boost-histogram and iminuit report this error.
hoodmane commentedon May 31, 2024
I can reproduce it, I'll take a look soon =)
FIX Prevent segfaults in CLI runner (#4836)
FIX Prevent segfaults in CLI runner (pyodide#4836)
ryanking13 commentedon Jun 8, 2024
Hmm, they use SDL and SDL symbols are splitted into main module and side modules so I guess it is somehow related.