Thanks for reporting, those errors are indeed bugs in glfw code, which we
didn't have coverage of with closure. Fix in

https://github.com/kripken/emscripten/pull/6364

plus testing.

On Wed, Mar 21, 2018 at 8:26 AM, Big boot <[email protected]> wrote:

> Hey there,
>
> I can't seem to get the closure compiler to work, using the -s USE_GLFW3
> and -Os flags.
> Without either of them, everything is fine. Am I missing something?
>
> I'm using emscripten 1.37.36 and my OS is Linux Mint 18.2 Cinnamon 64-bit.
>
>
> Using said flags together results in 2 errors and 41 warnings:
>
>
> Traceback (most recent call last):
>   File 
> "/home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/em++",
> line 15, in <module>
>     python_selector.run(emcc, profile=True)
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/python_selector.py", line 43, in run
>     sys.exit(run_by_import(filename, main) if on_allowed_version() else
> run_by_subprocess(filename))
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/python_selector.py", line 13, in run_by_import
>     return getattr(importlib.import_module(os.path.basename(filename)),
> main)()
>   File 
> "/home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/emcc.py",
> line 1847, in run
>     optimizer.flush()
>   File 
> "/home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/emcc.py",
> line 239, in flush
>     self.run_passes(chunks[0], title, just_split=False, just_concat=False)
>   File 
> "/home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/emcc.py",
> line 274, in run_passes
>     output_filename=self.in_temp(os.path.basename(final) + '.jsopted.js'))
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/shared.py", line 2074, in js_optimizer
>     ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info,
> just_split, just_concat)
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/js_optimizer.py", line 557, in run
>     return temp_files.run_and_clean(lambda: run_on_js(filename, passes,
> js_engine, source_map, extra_info, just_split, just_concat))
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/tempfiles.py", line 93, in run_and_clean
>     return func()
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/js_optimizer.py", line 557, in <lambda>
>     return temp_files.run_and_clean(lambda: run_on_js(filename, passes,
> js_engine, source_map, extra_info, just_split, just_concat))
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/js_optimizer.py", line 492, in run_on_js
>     cld = shared.Building.closure_compiler(cld, pretty='minifyWhitespace'
> not in passes)
>   File "/home/kevin/Projects/C++/external/emsdk-portable/
> emscripten/1.37.36/tools/shared.py", line 2206, in closure_compiler
>     raise Exception('closure compiler error: ' + process.stdout + ' (rc:
> %d)' % process.returncode)
> Exception: closure compiler error: /home/kevin/Projects/C++/
> external/emsdk-portable/emscripten/1.37.36/third_
> party/closure-compiler/node-externs/domain.js:67: WARNING - Bad type
> annotation. type not recognized due to syntax error. See
> https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for
> more information.
>  * @param {function(...[*])} callback
>                        ^
>
> /home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/third_
> party/closure-compiler/node-externs/domain.js:68: WARNING - Bad type
> annotation. type not recognized due to syntax error. See
> https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for
> more information.
>  * @return {function(...[*])}
>                         ^
>
> /home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/third_
> party/closure-compiler/node-externs/domain.js:73: WARNING - Bad type
> annotation. type not recognized due to syntax error. See
> https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for
> more information.
>  * @param {function(...[*])} callback
>                        ^
>
> /home/kevin/Projects/C++/external/emsdk-portable/emscripten/1.37.36/third_
> party/closure-compiler/node-externs/domain.js:74: WARNING - Bad type
> annotation. type not recognized due to syntax error. See
> https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for
> more information.
>  * @return {function(...[*])}
>                         ^
>
> /tmp/tmpspMPXo.cl.js:2351: WARNING - dangerous use of the global this
> object
>         this.id = id;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2352: WARNING - dangerous use of the global this
> object
>         this.x = 0;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2353: WARNING - dangerous use of the global this
> object
>         this.y = 0;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2354: WARNING - dangerous use of the global this
> object
>         this.fullscreen = false; // Used to determine if app in fullscreen
> mode
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2355: WARNING - dangerous use of the global this
> object
>         this.storedX = 0; // Used to store X before fullscreen
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2356: WARNING - dangerous use of the global this
> object
>         this.storedY = 0; // Used to store Y before fullscreen
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2357: WARNING - dangerous use of the global this
> object
>         this.width = width;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2358: WARNING - dangerous use of the global this
> object
>         this.height = height;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2359: WARNING - dangerous use of the global this
> object
>         this.storedWidth = width; // Used to store width before fullscreen
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2360: WARNING - dangerous use of the global this
> object
>         this.storedHeight = height; // Used to store height before
> fullscreen
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2361: WARNING - dangerous use of the global this
> object
>         this.title = title;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2362: WARNING - dangerous use of the global this
> object
>         this.monitor = monitor;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2363: WARNING - dangerous use of the global this
> object
>         this.share = share;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2364: WARNING - dangerous use of the global this
> object
>         this.attributes = GLFW.hints;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2365: WARNING - dangerous use of the global this
> object
>         this.inputModes = {
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2370: WARNING - dangerous use of the global this
> object
>         this.buttons = 0;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2371: WARNING - dangerous use of the global this
> object
>         this.keys = new Array();
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2372: WARNING - dangerous use of the global this
> object
>         this.domKeys = new Array();
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2373: WARNING - dangerous use of the global this
> object
>         this.shouldClose = 0;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2374: WARNING - dangerous use of the global this
> object
>         this.title = null;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2375: WARNING - dangerous use of the global this
> object
>         this.windowPosFunc = null; // GLFWwindowposfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2376: WARNING - dangerous use of the global this
> object
>         this.windowSizeFunc = null; // GLFWwindowsizefun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2377: WARNING - dangerous use of the global this
> object
>         this.windowCloseFunc = null; // GLFWwindowclosefun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2378: WARNING - dangerous use of the global this
> object
>         this.windowRefreshFunc = null; // GLFWwindowrefreshfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2379: WARNING - dangerous use of the global this
> object
>         this.windowFocusFunc = null; // GLFWwindowfocusfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2380: WARNING - dangerous use of the global this
> object
>         this.windowIconifyFunc = null; // GLFWwindowiconifyfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2381: WARNING - dangerous use of the global this
> object
>         this.framebufferSizeFunc = null; // GLFWframebuffersizefun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2382: WARNING - dangerous use of the global this
> object
>         this.mouseButtonFunc = null; // GLFWmousebuttonfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2383: WARNING - dangerous use of the global this
> object
>         this.cursorPosFunc = null; // GLFWcursorposfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2384: WARNING - dangerous use of the global this
> object
>         this.cursorEnterFunc = null; // GLFWcursorenterfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2385: WARNING - dangerous use of the global this
> object
>         this.scrollFunc = null; // GLFWscrollfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2386: WARNING - dangerous use of the global this
> object
>         this.dropFunc = null; // GLFWdropfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2387: WARNING - dangerous use of the global this
> object
>         this.keyFunc = null; // GLFWkeyfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2388: WARNING - dangerous use of the global this
> object
>         this.charFunc = null; // GLFWcharfun
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:2389: WARNING - dangerous use of the global this
> object
>         this.userptr = null;
>         ^^^^
>
> /tmp/tmpspMPXo.cl.js:3004: WARNING - If this if/for/while really shouldn't
> have a body, use {}
>         for (i = 0; i < GLFW.windows.length && GLFW.windows[i] !== null;
> i++);
>
>    ^
>
> /tmp/tmpspMPXo.cl.js:3020: WARNING - If this if/for/while really shouldn't
> have a body, use {}
>         for (i = 0; i < GLFW.windows.length && GLFW.windows[i] == null;
> i++);
>
>   ^
>
> /tmp/tmpspMPXo.cl.js:2615: ERROR - variable eventButton is undeclared
>         eventButton = GLFW.DOMToGLFWMouseButton(event);
>         ^^^^^^^^^^^
>
> /tmp/tmpspMPXo.cl.js:3064: ERROR - variable table is undeclared
>         table = {
>         ^^^^^
>
> 2 error(s), 41 warning(s)
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to