Thanks Alon!

On Thu, Dec 19, 2019, 19:22 Alon Zakai <[email protected]> wrote:

> Actually I see that is a real difference between the backends, so we
> should flip that flag on automatically. I will open a PR.
>
> Meanwhile as a workaround, -s EXPORT_ALL (on the main module) should fix
> things for you, Mehdi.
>
> - Alon
>
>
> On Thu, Dec 19, 2019 at 10:13 AM Alon Zakai <[email protected]> wrote:
>
>> I think the emscripten_log issue is
>>
>> https://github.com/emscripten-core/emscripten/issues/9793
>>
>> which I am not sure what to do about. Perhaps at minimum we should make
>> that error message also suggest flipping EXPORT_ALL?
>>
>> On Wed, Dec 18, 2019 at 2:53 PM 'Sam Clegg' via emscripten-discuss <
>> [email protected]> wrote:
>>
>>>
>>>
>>> On Tue, Dec 17, 2019 at 8:08 AM Mehdi Sabwat <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to understand the expected behavior of Emscripten when we
>>>> have a SIDE_MODULE that links to a standard library.
>>>>
>>>> I am having this message:
>>>> Assertion failed: missing linked function `_emscripten_log`. perhaps a
>>>> side module was not linked in? if this global was expected to arrive
>>>> from a system library, try to build the MAIN_MODULE with
>>>> EMCC_FORCE_STDLIBS=1 in the environment
>>>>
>>>> with the following code :
>>>>
>>>> test1.c:
>>>> #include <dlfcn.h>
>>>> #include <stdio.h>
>>>> #include <pthread.h>
>>>> #include <emscripten.h>
>>>>
>>>> int main(int ac, char **av)
>>>> {
>>>>   void *handle = dlopen("./libwasmdog.wasm", RTLD_LAZY);
>>>>   void (*fun_print_name)(const char *) = dlsym(handle, "print_name");
>>>>   fun_print_name(av[1]);
>>>>   /*
>>>>
>>>>     emscripten_log(EM_LOG_CONSOLE, "removing this call will brake
>>>> linking\n");
>>>>     emscripten_debugger();
>>>>
>>>>   */
>>>>   return 0;
>>>> }
>>>>
>>>> EMCC_FORCE_STDLIBS=1 emcc -g -s MAIN_MODULE=1 test1.c -o test.html --
>>>> preload-file ./libwasmdog.wasm -s ALLOW_MEMORY_GROWTH=1
>>>> and
>>>> dog.c:
>>>> #include "animal.h"
>>>> #include <stdio.h>
>>>> #include <stdlib.h>
>>>> #include <emscripten.h>
>>>>
>>>> void print_name(const char *type)
>>>> {
>>>>   emscripten_log(EM_LOG_JS_STACK, "\n");
>>>>   emscripten_debugger();
>>>>   printf("Je suis un %s\n", type);
>>>> }
>>>> emcc -g -s SIDE_MODULE=1 dog.c -o libwasmdog.wasm -s 
>>>> "EXPORTED_FUNCTIONS=['_emscripten_log',
>>>> '_emscripten_debugger']"
>>>>
>>>> Is this a bug, or am I doing it wrong?
>>>>
>>>
>>> One this that looks wrong here is that you should be exporting
>>> `print_name` from the side module..  Those emscripten functions are being
>>> imported (in this case from JS).
>>>
>>> However that doesn't explain why _emscripten_log would be undefined.
>>>  One thing you could try is calling `emscripten_log` from the main module
>>> too.. that would force the JS code for this function to be included.   If
>>> that fixes the problem then I guess you need to
>>> `EXTRA_EXPORTED_RUNTIME_METHODS`.  TBH I'm surprised this isn't already
>>> included when building with MAIN_MODULE.   I seems like all JS functions
>>> should be included in that case, but I must be mis-remembering.
>>>
>>>
>>>
>>>> Thank you!
>>>>
>>>> --
>>>> 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].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/emscripten-discuss/470197cd-6ade-440b-a945-9e271b09c77f%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/emscripten-discuss/470197cd-6ade-440b-a945-9e271b09c77f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_WuveDwGK1UEAq%3DopKnF_5eDqzpo3R_%3DQVr_Sz2gR%3DEQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_WuveDwGK1UEAq%3DopKnF_5eDqzpo3R_%3DQVr_Sz2gR%3DEQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpQHgW%3D7u5xVJktq%2BfYHvBCPvMx%3Dpy4pKbr3Pw3hCRqi6Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpQHgW%3D7u5xVJktq%2BfYHvBCPvMx%3Dpy4pKbr3Pw3hCRqi6Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CANLCaymRvjg6N3kcjrkHN7Z16sn4b%2BFhngp8Z080WURuCpuQ9g%40mail.gmail.com.

Reply via email to