Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm_opt + -g fails #8229

Closed
Beuc opened this Issue Mar 2, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@Beuc
Copy link
Contributor

Beuc commented Mar 2, 2019

Hi,

With 1.38.28 and -g I get the following error when linking with emcc:

Fatal: Module::addFunction: $dynCall_vi already exists
shared:ERROR: '/home/me/.emscripten_ports-incoming-renpyweb/binaryen/binaryen-version_68/bin/wasm-opt /home/me/workdir/emtests/renpyweb/build/t/index.wasm -o /home/me/workdir/emtests/renpyweb/build/t/index.wasm --fpcast-emu --mvp-features -g' failed (1)

Sadly I don't have a minimal test case for this.

Full compile command:

emcc /home/me/workdir/emtests/renpyweb/build/main-renpyweb-static.bc /home/me/workdir/emtests/renpyweb/build/importexport.bc /home/me/workdir/emtests/renpyweb/build/pygame_sdl2-static/emscripten-static/build-temp/gen/*.o /home/me/workdir/emtests/renpyweb/build/pygame_sdl2-static/emscripten-static/build-temp/src/*.o /home/me/workdir/emtests/renpyweb/build/renpy/module/emscripten-static/build-temp/*.o /home/me/workdir/emtests/renpyweb/build/renpy/module/emscripten-static/build-temp/gen/*.o \
    -L /home/me/workdir/emtests/renpyweb/install/lib -O2 -s ASSERTIONS=1 -g /home/me/workdir/emtests/renpyweb/build/emscripten.bc -s EMULATE_FUNCTION_POINTER_CASTS=1 -s FORCE_FILESYSTEM=1 -lpython2.7 -s USE_SDL=2 -lSDL2_image -ljpeg -lpng -lwebp -lz -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST='["_main", "_pyapp_runmain", "_SDL_WaitEvent", "_SDL_WaitEventTimeout", "_SDL_Delay", "_SDL_RenderPresent", "_GLES2_RenderPresent", "_SDL_GL_SwapWindow", "_Emscripten_GLES_SwapWindow", "_PyRun_SimpleFileExFlags", "_PyRun_FileExFlags", "_PyEval_EvalCode", "_PyEval_EvalCodeEx", "_PyEval_EvalFrameEx", "_PyCFunction_Call", "_PyObject_Call", "_fast_function", "_function_call", "_instancemethod_call", "_slot_tp_call", "___pyx_pw_11pygame_sdl2_5event_7wait", "___pyx_pw_11pygame_sdl2_7display_21flip", "___pyx_pw_11pygame_sdl2_7display_6Window_13flip", "___pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30draw_screen", "___pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31draw_screen", "___Pyx_PyObject_CallNoArg_*", "___pyx_pf_10emscripten_6sleep", "___pyx_pw_10emscripten_7sleep", "___pyx_pf_10emscripten_8sleep_with_yield", "___pyx_pw_10emscripten_9sleep_with_yield", "_gen_send", "_gen_send_ex", "_gen_iternext", "_type_call", "_slot_tp_init", "_PyDict_SetItem", "_PyDict_SetItemString", "_PySys_SetObject", "_PyErr_PrintEx"]' -s USE_FREETYPE=1 -lavformat -lavcodec -lavutil -lswresample -lswscale -lfribidi -lzip -s EXPORTED_FUNCTIONS='["_main", "_Py_Initialize", "_PyRun_SimpleString", "_pyapp_runmain", "_emSavegamesImport", "_emSavegamesExport"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -s FULL_ES2=1 --shell-file renpy-shell.html --pre-js renpy-pre.js \
    -s TOTAL_MEMORY=128MB -s ALLOW_MEMORY_GROWTH=1 \
    -s EMTERPRETIFY_FILE=/home/me/workdir/emtests/renpyweb/build/t/index.em \
    -o /home/me/workdir/emtests/renpyweb/build/t/index.html

Same result with ASSERTIONS=0.

@kripken

This comment has been minimized.

Copy link
Member

kripken commented Mar 2, 2019

Can you send me the wasm file, even if it's not small?

If not, running with BINARYEN_PASS_DEBUG=1 in the env will print out the passes as they run, which will at least show in which pass this happens.

@Beuc

This comment has been minimized.

Copy link
Contributor Author

Beuc commented Mar 3, 2019

Sure, https://www.beuc.net/tmp/index.wasm

Here's the end of the BINARYEN_PASS_DEBUG output:

[PassRunner] (final validation)
[PassRunner] running passes...
[PassRunner]   running pass: fpcast-emu... Fatal: Module::addFunction: $dynCall_vi already exists
shared:ERROR: '/home/me/.emscripten_ports-incoming-renpyweb/binaryen/binaryen-version_68/bin/wasm-opt /home/me/workdir/emtests/renpyweb/build/t/index.wasm -o /home/me/workdir/emtests/renpyweb/build/t/index.wasm --fpcast-emu --mvp-features -g' failed (1)
make: *** [Makefile:277: wasm] Error 1

real	6m3,895s
user	8m44,339s
sys	0m23,119s
@kripken

This comment has been minimized.

Copy link
Member

kripken commented Mar 3, 2019

Thanks, yeah, it's that fpcast-emu pass that was to blame (or rather some library code it calls). Fix in WebAssembly/binaryen#1932

kripken added a commit to WebAssembly/binaryen that referenced this issue Mar 7, 2019

Don't create already-existing dynCalls (#1932)
This can happen in emscripten if we run fpcast-emu after previous passes created dynCalls already. If so, it's fine to just do nothing.

Fixes emscripten-core/emscripten#8229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.