I would expect unused imports to be optimized out. Perhaps this is a case
where the compiler is not able to eliminate some function that is
referencing the given object. I don't think this would work natively
either, but linker would error out at link time on a missing symbol
(similar to what you will get if linking with -s
ERROR_ON_UNDEFINED_SYMBOLS=1 in Emscripten)

You could try adding a single .cpp file to the build with that symbol
defined, or add a __EMSCRIPTEN__ specific path somewhere that defines it,
or hook into Wasm instantiation in the html file and add that entry in the
import object.

torstai 10. elokuuta 2017 Александр Гурьянов <caiiiy...@gmail.com>
kirjoitti:

> Chrome error:
> failed to asynchronously prepare wasm: LinkError: Import #3
> module="env" function="__ZN6Editor10s_instanceE" error: global import
> must be a number
> testing.html:160 LinkError: Import #3 module="env"
> function="__ZN6Editor10s_instanceE" error: global import must be a
> number
>     at http://localhost/bin.js?timestamp=1502360564253:5659:23
>     at <anonymous>
> testing.html:161 LinkError: Import #3 module="env"
> function="__ZN6Editor10s_instanceE" error: global import must be a
> number
>     at http://localhost/bin.js?timestamp=1502360564253:5659:23
>     at <anonymous>
> testing.html:1 Uncaught (in promise) abort({}) at Error
>     at jsStackTrace (http://localhost/bin.js?timestamp=1502360564253:5206:
> 12)
>     at stackTrace (http://localhost/bin.js?timestamp=1502360564253:5220:11
> )
>     at abort (http://localhost/bin.js?timestamp=1502360564253:15934:43)
>     at http://localhost/bin.js?timestamp=1502360564253:5664:4
>     at <anonymous>
> If this abort() is unexpected, build with -s ASSERTIONS=1 which can
> give more information.
>
>
>
> 2017-08-10 17:32 GMT+07:00 Александр Гурьянов <caiiiy...@gmail.com
> <javascript:;>>:
> > emcc (Emscripten gcc/clang-like replacement) 1.37.18 (commit
> > cb2260892ddc2c73aa40dbe0821f5a8ce3f79975)
> >
> > bin.js:
> >   function __ZN6Editor10s_instanceE() {
> >    Module["printErr"]("missing function: _ZN6Editor10s_instanceE");
> >    abort(-1);
> >   }
> > // ...
> >   getBinaryPromise().then((function(binary) {
> >    return WebAssembly.instantiate(binary, info); // <-- HERE
> >   })).then((function(output) {
> >
> > I don't know how to look inside wasm, it's looks like binary file:
> > STACKTOP  env    STACK_MAX  env __ZN6Editor10s_instanceE  env
> >
> > c++:
> > class Editor {
> > private:
> >     static Editor* s_instance;
> > public:
> >     static Editor* getInstance() { return s_instance; }
> >
> > }
> >
> >
> > Yes it's a singleton pointer, but this class is not implemented, it
> > have many undefined references, including to s_instance:
> > 51: undefined reference to `Editor::s_instance'
> >
> > So I think problem in that place, but I don't want to implement it, it
> > never calls.
> >
> >
> > 2017-08-10 17:12 GMT+07:00 Jukka Jylänki <juj...@gmail.com
> <javascript:;>>:
> >> Is that on latest Emscripten 1.37.18? That looks like a new error that
> >> is not known. What does the generated code around that location look
> >> like? What should __ZN6Editor10s_instanceE be, is that a singleton
> >> pointer?
> >>
> >> 2017-08-10 6:55 GMT+03:00 Александр Гурьянов <caiiiy...@gmail.com
> <javascript:;>>:
> >>> Update on compile time:
> >>> -O2 - ~60 sec
> >>> -O3 - ~7 sec
> >>>
> >>> Also I try to build project with WASM=1, and it built successfully,
> >>> but I can't run it due this error:
> >>> failed to asynchronously prepare wasm: LinkError: import object field
> >>> '__ZN6Editor10s_instanceE' is not a Number  testing.html:161:40
> >>> LinkError: import object field '__ZN6Editor10s_instanceE' is not a
> >>> Number  testing.html:160:37
> >>> LinkError: import object field '__ZN6Editor10s_instanceE' is not a
> >>> Number  testing.html:161:40
> >>>
> >>> I have some unresovled symbols in project, but this symbols never
> >>> calls from code. I also build native version with flag
> >>> -Wl,--unresolved-symbols=ignore-all and it works fine, asm.js also
> >>> works.
> >>>
> >>> 2017-08-09 19:36 GMT+07:00 Александр Гурьянов <caiiiy...@gmail.com
> <javascript:;>>:
> >>>> The source is not public, but I think I can share result js if it's
> useful.
> >>>>
> >>>> I will try to build WebAssembly and check.
> >>>>
> >>>> 2017-08-09 19:04 GMT+07:00 Jukka Jylänki <juj...@gmail.com
> <javascript:;>>:
> >>>>> This looks like a performance bug in the browser. It may be possible
> >>>>> to reduce the compilation time, but without a test case it's not
> >>>>> possible to know what might be wrong. Is the project public
> somewhere?
> >>>>>
> >>>>> One known source of slow compilation times is if one has very large
> >>>>> switch-case statements with tens of thousands of cases.
> >>>>>
> >>>>> Though FF 54 already supports WebAssembly. Do you have a WebAssembly
> >>>>> build of the same, does that compile quickly on Firefox?
> >>>>>
> >>>>> 2017-08-09 14:52 GMT+03:00 caiiiycuk <caiiiy...@gmail.com
> <javascript:;>>:
> >>>>>> Hi. I use Firefox 54.0 to test my game that I compile from C++ to
> js. Js
> >>>>>> size is 6.3Mb, when I open game in FF, then it compiles asm.js for
> very long
> >>>>>> time:
> >>>>>> Successfully compiled asm.js code (total compilation time 55703ms;
> stored in
> >>>>>> cache)
> >>>>>>
> >>>>>> As you see I wait one minute before game starts,  all other
> browsers start
> >>>>>> game immediately. It's possible to reduce this compilation time?
> >>>>>>
> >>>>>> I have very powerfull CPU - i7, os is Ubuntu x64
> >>>>>>
> >>>>>> --
> >>>>>> 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 emscripten-discuss+unsubscr...@googlegroups.com
> <javascript:;>.
> >>>>>> 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 emscripten-discuss+unsubscr...@googlegroups.com
> <javascript:;>.
> >>>>> 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 emscripten-discuss+unsubscr...@googlegroups.com <javascript:;>
> .
> >>> 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 emscripten-discuss+unsubscr...@googlegroups.com <javascript:;>
> .
> >> 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 emscripten-discuss+unsubscr...@googlegroups.com <javascript:;>.
> 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 emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to