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
When running this build we start getting all sorts of run time errors on the JS side of things.
It is important to note that building the app with all the commands listed above except those that are responsible for building the module works fine. Once we modularize the wasm it seems to be failing loading the worker.
Here is the error message we are getting from the browser:
Also this:
Now,examining the generated .js file we see that is can be related to the fact that allocateUnusedWorker() function needs to specify the type: module ,smth like this:
new Worker(new URL("FooWEB.worker.js", import.meta.url), {
type: "module",
})
Instead it does this:
new Worker(new URL("FooWEB.worker.js", import.meta.url))
Additionally,
Module["canvas"] seems to be undefined
Module["PThread"].receiveObjectTransfer(e.data); this doesn't seem to be called,which causes canvas not to initialize.
Therefore, worker never receives a message with "run", which should call Module["PThread"].receiveObjectTransfer(e.data);
Then receiveObjectTransfer in FooWEB.js, which seems responsible for assigning Module["canvas"] = GL.offscreenCanvases[data.moduleCanvasId].offscreenCanvas;
Module["canvas"].id = data.moduleCanvasId; is never called, which leads to this:
___pthread_create_js does not find Module["canvas"] and it throws
err(
'pthread_create: could not find canvas with ID "' +
name +
'" to transfer to thread!'
);
Am I missing something in the build configuration?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi. We are building emscr app that uses pthreads as a module.
Here are the linker options:
When running this build we start getting all sorts of run time errors on the JS side of things.
It is important to note that building the app with all the commands listed above except those that are responsible for building the module works fine. Once we modularize the wasm it seems to be failing loading the worker.
Here is the error message we are getting from the browser:
Also this:
Now,examining the generated .js file we see that is can be related to the fact that
allocateUnusedWorker()
function needs to specify the type: module ,smth like this:Instead it does this:
new Worker(new URL("FooWEB.worker.js", import.meta.url))
Additionally,
Module["canvas"]
seems to be undefinedModule["PThread"].receiveObjectTransfer(e.data);
this doesn't seem to be called,which causes canvas not to initialize.Therefore, worker never receives a message with "run", which should call Module["PThread"].receiveObjectTransfer(e.data);
Then receiveObjectTransfer in FooWEB.js, which seems responsible for assigning
Module["canvas"] = GL.offscreenCanvases[data.moduleCanvasId].offscreenCanvas;
Module["canvas"].id = data.moduleCanvasId;
is never called, which leads to this:___pthread_create_js
does not findModule["canvas"]
and it throwsAm I missing something in the build configuration?
Beta Was this translation helpful? Give feedback.
All reactions