> Also, this bug report may be somehow remotely related: 
> https://github.com/kripken/emscripten/issues/5361
I don't think so, because in that bug undefined symbol is actually
used in runtime. But in my case undefined symbols never used in
runtime. But I think you right compiler does not understand that
symbol is not used and erro ont it.

> I don't think this would work natively either, but linker would error out at 
> link time on a missing symbol
You right again, compiler show this error, but as I said before I use
flag "-Wl,--unresolved-symbols=ignore-all" to avoid this error.

> You could try adding a single .cpp file to the build with that symbol defined

My project is big game, that have two parts: game and editor. Editor
is used by game devs, to make levels etc. Editor can be activated by
special in-game flag. But for gaming editor is not needed, and it is
hard task to compile it in web. So best solution is to drop editor's
*.cpp and compile with "-Wl,--unresolved-symbols=ignore-all". In that
case game works perfect, and it's much easier to compile.

Btw, I add implementation for s_editor, and now I have same error but
on next undefined symbol:
LinkError: import object field '__ZTI11EditorScene' is not a Number

Of course I can add mock implementation for all Editor's symbols, but
may be there is a better solution?

2017-08-12 21:34 GMT+07:00 Jukka Jylänki <juj...@gmail.com>:
> Also, this bug report may be somehow remotely related:
> https://github.com/kripken/emscripten/issues/5361
>
>
> lauantai 12. elokuuta 2017 Jukka Jylänki <juj...@gmail.com> kirjoitti:
>>
>> 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>:
>>> > 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>:
>>> >> 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>:
>>> >>> 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>:
>>> >>>> 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>:
>>> >>>>> 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>:
>>> >>>>>> 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.
>>> >>>>>> 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.
>>> >>>
>>> >>> --
>>> >>> 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.
>>> >>
>>> >> --
>>> >> 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.
>>>
>>> --
>>> 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.
>
> --
> 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.

-- 
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