Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emscriptten built wasm module didn't load and had crash in reactjs project. #8

Open
Realitian opened this issue Jul 18, 2022 · 3 comments

Comments

@Realitian
Copy link

Realitian commented Jul 18, 2022

Hi,
I tried to build wasm as single-thread mode by set USE_PTHREADS=0 and tried to load it in a simple threejs based react-js project.
But it failed to load and crashed with following error.

Uncaught (in promise) RuntimeError: memory access out of bounds
at emHdBindings.wasm:0x5c7ae4
at emHdBindings.wasm:0x5ca39e
at emHdBindings.wasm:0x52afbf
at emHdBindings.wasm:0x537a96
at emHdBindings.wasm:0x6591c4
at emHdBindings.wasm:0x52bbdc
at emHdBindings.wasm:0x3e44d8
at emHdBindings.wasm:0x3e413b
at emHdBindings.wasm:0x1839c
at emHdBindings.wasm:0x18001

Btw, it worked with webpack based threejs-vanillar project.
It is strange why it does not work in reactjs based.
Please advice me if anybody has clue.

@kaischroeder , Could you check my issue?

@hybridherbst
Copy link

Ran into the same issue (needle-tools/usd-viewer#7) and it might be a Windows-only problem with local development – the same works fine on Mac and Linux machines.

Before that error, on Windows there's a log regarding files not being found (file /usd/plugInfo.json couldn't be read):
image

@michaelybecker
Copy link

+1, on multiple projects that leverage the runtime - all fail on PCs when run locally, all work on mac.

@pecasha
Copy link

pecasha commented Nov 18, 2023

I think I found the reason. It is a problem with the emHdBindings.data file.
Just use this linked file to replace in your project.
https://www.usdz-viewer.net/wasm/emHdBindings.data


The line separator of the emHdBindings.data file seems to need to be LF, but in the Windows, it will be automatically converted to CRLF during git commit, which leads to this error.

You can add .gitattributes configuration to solve the problem of line separators.

*.data text eol=lf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants