Open jspanchu opened 1 year ago
What's interesting is that this error doesn't occur when -g1
or higher is used.
/** @suppress {duplicate } */ function _glClientWaitSync(sync, flags, timeout_low) {
That definitely looks wrong, as there should be timeout_high
right after it, like this:
$ ./emcc test/hello_world.c -sINCLUDE_FULL_LIBRARY -sUSE_WEBGL2 -O1 --closure 1 -g0 -s EXPORTED_FUNCTIONS=_main,_glClientWaitSync
$ grep glClientWaitSync a.out.js
f._glClientWaitSync = (a, b, c, d) => hc.clientWaitSync(wc[a], b, (c >>> 0) + 4294967296 * d);
There are 4 parameters there. But note that their names are minified, which yours aren't, which suggests closure wasn't actually run on yours..?
Yea, we expected to find a timeout_high
right after. Which emcc
did you use? The only difference is we used -Oz -g0 --closure 1
, whereas in your command, I see -O1 -g0 --closure 1
. Do you think the Oz
flag caused it?
No, -Oz
does not matter here:
$ ./emcc test/hello_world.c -sINCLUDE_FULL_LIBRARY -sUSE_WEBGL2 -Oz --closure 1 -g0 -s EXPORTED_FUNCTIONS=_main,_glClientWaitSync
$ grep glClientWaitSync a.out.js
b.Wa=b.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance");2<=a.version&&(b.ia=b.getExtension("EXT_disjoint_timer_query_webgl2"));if(2>a.version||!b.ia)b.ia=b.getExtension("EXT_disjoint_timer_query");b.Xa=b.getExtension("WEBGL_multi_draw");(b.getSupportedExtensions()||[]).forEach(c=>{c.includes("lose_context")||c.includes("debug")||b.getExtension(c)})}},bc={},fc,xc=[],S={},kc;f._glClientWaitSync=(a,b,c,d)=>ec.clientWaitSync(uc[a],b,(c>>>0)+4294967296*d);
Still 4 minified params, as expected.
The odd thing is they are not minified in yours. Perhaps some other flag you are passing in disables closure? If you can provide a full minimal testcase this should be easy to debug using EMCC_DEBUG=1
, or you can do that locally yourself (inspect the temp files and see where things go wrong).
Thanks for the hint, the project we see this is pretty big. I'll try in a smaller example locally and get back.
This also happens attempting to compile canvaskit in release mode if you add 4GB memory limit, goes away if closure=1 is removed.
@jezell can you share the generated glClientWaitSync function?
When I build with /emcc test/hello_world.c -sINITIAL_MEMORY=4gb -sINCLUDE_FULL_LIBRARY -sUSE_WEBGL2 -Oz --minify 0 --closure 1 -g0 -s EXPORTED_FUNCTIONS=_main,_glClientWaitSync
I get the following:
f._glClientWaitSync = function(a, b, c, d) {
return uc.clientWaitSync(nc[a >>> 0], b, (c >>> 0) + 4294967296 * d);
};
Do you not also get a 4 argument function?
When compiling with
-Oz -g0 --closure=1
, the compiler complains thattimeout_high
is not defined.Error:
For some reason, the generated code for that function
glClientWaitSync
doesn't havetimeout_high
in it's arguments. It thinks that parameter is unused?Version of emscripten/emsdk: Please include the output
emcc -v
here