physx-js-webidl icon indicating copy to clipboard operation
physx-js-webidl copied to clipboard

WASM Runtime Error on Safari

Open sheley1998 opened this issue 2 years ago • 3 comments

Thank you for your incredible work!

I've gotten everything to run on Chrome and Firefox. However, when I try execute PhysX() on Safari, I get the following error:

Unhandled Promise Rejection: RuntimeError: Aborted(CompileError: WebAssembly.Module doesn't parse at byte 5: can't get Function local's type in group 1, in function at index 4967)

I'm running Safari 16.2 on MacOS Ventura 13.1, Apple M1 chip

I'll try to build from source and see if there's anything I could change to get it to work. Would appreciate if you could look into it as well!

Cheers

sheley1998 avatar Dec 29 '22 16:12 sheley1998

Hmm might be SIMD related. WASM SIMD support is still experimental, so Safari might not fully support it.

You can try to recompile the library with SIMD disabled by adding the following line to the physx/source/compiler/cmake/emscripten/CMakeLists.txt cmake file:

ADD_DEFINITIONS(-DPX_SIMD_DISABLED)

fabmax avatar Dec 30 '22 14:12 fabmax

Thanks for the tip. While that didn't seem to work, apparently the debug code path has SIMD disabled by default, which runs well in Safari. Unfortunately, debug build is 10mb larger than release build. I'll tinker with build settings some more, hopefully there's a better approach.

sheley1998 avatar Jan 31 '23 18:01 sheley1998

I added ADD_DEFINITIONS(-DPX_SIMD_DISABLED=1) and remove -msimd128, it worked. Thanks.

May2nd avatar Jun 17 '24 10:06 May2nd