-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
build with pthreads always includes library_webgl.js #11805
Comments
This is a known current limitation, unfortunately the pthreads proxying mechanism adds dependencies to other libraries (GL is one of them), that we don't currently build variations of to get them stripped away. |
If you'd like to strip this away manually, edit |
Thanks. In my application the following hack reduces generated js from 36K to 32K ( diff --git a/system/lib/pthread/library_pthread.c b/system/lib/pthread/library_pthread.c
index 7811167ed..717246828 100644
--- a/system/lib/pthread/library_pthread.c
+++ b/system/lib/pthread/library_pthread.c
@@ -218,15 +218,17 @@ static void _do_call(em_queued_call* q) {
q->returnValue.i =
pthread_create(q->args[0].vp, q->args[1].vp, q->args[2].vp, q->args[3].vp);
#endif
break;
+#if 0
case EM_PROXIED_CREATE_CONTEXT:
q->returnValue.i = emscripten_webgl_create_context(q->args[0].cp, q->args[1].vp);
break;
case EM_PROXIED_RESIZE_OFFSCREENCANVAS:
q->returnValue.i =
emscripten_set_canvas_element_size(q->args[0].cp, q->args[1].i, q->args[2].i);
break;
+#endif
case EM_PROXIED_JS_FUNCTION:
q->returnValue.d =
emscripten_receive_on_main_thread_js((int)q->functionPtr, q->args[0].i, &q->args[1].d);
break; |
The only other remaining large unused function is |
Hmm, that sounds like something else. Off the top of my head I think pthreads should not be pulling in |
The strftime issue does seem unrelated, I don't see any references to it from pthreads code, and it doesn't show up with building hello world with pthreads. Do you have a testcase @niklasf that shows it is included even though it's not used? |
It's happening in https://github.com/niklasf/stockfish.wasm, but so far I haven't been able to reduce it to a smaller test case. I can confirm it's not included in Meanwhile, since I am now patching emscripten anyway, as above, I just replaced the implementation with a call to |
If you want to see why a given symbol is included you can try the |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
Still relevant. |
There seem to be two different issues here: GL and strftime. For the GL issue it sounds like you have a workaround and we have no plans to fix. For the |
Ok, closing the main part (GL) as won'tfix, then. Will reopen the |
Can you maybe try with you try |
Oh, that yields the following output while linking:
Followed by:
|
So it seems that |
It looks like PR #14912 makes the pthread library no longer depend on WebGL. |
PR #16405, which has just landed, makes the pthread library no longer dependent on WebGL. |
Awesome. Thanks for the heads-up! |
Example invocation:
Does not use any graphics, but output
a.out.js
containsand so on.
Not eliminated when using
-O3
or even--closure 1
.The text was updated successfully, but these errors were encountered: