Please include the following in your bug report:
Version of emscripten/emsdk:
Please include the output emcc -v here
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.23 (5ae63ce)
clang version 16.0.0 (https://github.com/llvm/llvm-project 8b587113b746f31b63fd6473083df78cef30a72e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/terop/cvs/emscripten/emsdk/upstream/bin
Failing command line in full:
If this is compile or link-time failure please include the full failing command
along with its entire output.
Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
Adding directories to PATH:
PATH += /home/terop/cvs/emscripten/emsdk
PATH += /home/terop/cvs/emscripten/emsdk/upstream/emscripten
PATH += /home/terop/cvs/emscripten/emsdk/node/14.18.2_64bit/bin
Setting environment variables:
PATH = /home/terop/cvs/emscripten/emsdk:/home/terop/cvs/emscripten/emsdk/upstream/emscripten:/home/terop/cvs/emscripten/emsdk/node/14.18.2_64bit/bin:/home/terop/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
EMSDK = /home/terop/cvs/emscripten/emsdk
EM_CONFIG = /home/terop/cvs/emscripten/emsdk/.emscripten
EMSDK_NODE = /home/terop/cvs/emscripten/emsdk/node/14.18.2_64bit/bin/node
make -j 8 -f Makefile.LinuxEm
make[1]: warning: -j8 forced in submake: resetting jobserver mode.
make[1]: Siirrytään hakemistoon ”/home/terop/cvs/GameApi/GameApi”
Deps GameApi_low.cc -o objs/GameApi_low.d
Deps GameApi_main.cc -o objs/GameApi_main.d
em++ GameApi_main.cc -o objs/GameApi_main.bc
em++ GameApi_low.cc -o objs/GameApi_low.bc
echo em++ libGameApi.bc
em++ libGameApi.bc
em++ -shared objs/GameApi_gui.bc objs/GameApi_gltf.bc objs/GameApi_diag.bc objs/Pieces.bc objs/Map.bc objs/VectorTools.bc objs/Effect.bc objs/Buffer.bc objs/Intersect.bc objs/Bitmap.bc objs/Effect2.bc objs/Shader.bc objs/VolumeObjects.bc objs/Tree.bc objs/Event.bc objs/ObjectCreator.bc objs/IntersectObject.bc objs/Graph.bc objs/Widgets.bc objs/Category.bc objs/Plane.bc objs/Coordinates.bc objs/Triangle.bc objs/Game.bc objs/Editor.bc objs/Web.bc objs/Functions.bc objs/ShaderExpr.bc objs/Font.bc objs/FontEditor.bc objs/GameApi.bc objs/GameApiTest.bc objs/Games.bc objs/HierarchyObject.bc objs/Physics.bc objs/GameApiTest2.bc objs/State.bc objs/Serialize.bc objs/KeyFrameEditor.bc objs/Parser.bc objs/FreeType.bc objs/FreeType2.bc objs/VertexArray.bc objs/StateChange.bc objs/DistanceObject.bc objs/GameRunner.bc objs/GameApi_an.bc objs/GameApi_bm.bc objs/GameApi_co.bc objs/GameApi_dr.bc objs/GameApi_ev.bc objs/GameApi_ex.bc objs/GameApi_fbo.bc objs/GameApi_f.bc objs/GameApi_fn.bc objs/GameApi_fnt.bc objs/GameApi_gr.bc objs/GameApi_lay.bc objs/GameApi_li.bc objs/GameApi_main.bc objs/GameApi_mx.bc objs/GameApi_pc.bc objs/GameApi_phy.bc objs/GameApi_pla.bc objs/GameApi_pl.bc objs/GameApi_pt.bc objs/GameApi_pts.bc objs/GameApi_sh.bc objs/GameApi_shm.bc objs/GameApi_sm.bc objs/GameApi_spa.bc objs/GameApi_sp.bc objs/GameApi_st.bc objs/GameApi_su.bc objs/GameApi_tex.bc objs/GameApi_tr.bc objs/GameApi_trk.bc objs/GameApi_tx.bc objs/GameApi_vbo.bc objs/GameApi_ve.bc objs/GameApi_vo.bc objs/GameApi_wmod.bc objs/GameApi_wv.bc objs/GameApi_vx.bc objs/GameApi_cut.bc objs/GameApi_in.bc objs/GameApi_imp.bc objs/GameApi_plane.bc objs/GameApi_integrator.bc objs/Main.bc objs/GameApi_vr.bc objs/GameApi_low.bc objs/GameApi_dep_add_find.bc objs/GameApi_dep_env.bc objs/GameApi_dep_arr_render.bc objs/GameApi_webcam.bc objs/Math2.bc objs/GameApi_cmd_move.bc objs/GameApi_cmd_bbitmap.bc objs/GameApi_cmd_pdfield.bc objs/GameApi_cmd_bitmap.bc objs/GameApi_cmd_point.bc objs/GameApi_cmd_booleanops.bc objs/GameApi_cmd_points.bc objs/GameApi_cmd_cvolume.bc objs/GameApi_cmd_polygon2.bc objs/GameApi_cmd_fbitmap.bc objs/GameApi_cmd_polygon.bc objs/GameApi_cmd_font.bc objs/GameApi_cmd_framebuffer.bc objs/GameApi_cmd_texture.bc objs/GameApi_cmd_fvolume.bc objs/GameApi_cmd_lines.bc objs/GameApi_cmd_vector.bc objs/GameApi_cmd_mainloop.bc objs/GameApi_cmd_volume.bc objs/GameApi_cmd_material.bc objs/GameApi_cmd_waveform.bc objs/GameApi_cmd_shader.bc objs/GameApi_cmd.bc objs/cpushader.bc objs/music.bc objs/music_html5.bc objs/prerequisites.bc -o libGameApi.bc -s ERROR_ON_UNDEFINED_SYMBOLS=0 -Lhssynth2/synthlib/emscripten -lsynthlib -Lhssynth2/midiplay/midifile/emscripten -lmidifilelib
em++: warning: linking a library with -shared will emit a static object file. This is a form of emulation to support existing build systems. If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]
make[1]: Poistutaan hakemistosta ”/home/terop/cvs/GameApi/GameApi”
(cd web_page; make -f Makefile.LinuxEm pthreads_both)
make[1]: Siirrytään hakemistoon ”/home/terop/cvs/GameApi/GameApi/web_page”
(cd ..;em++ -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=30 -s FILESYSTEM=0 -g -gsource-map --source-map-base https://meshpage.org/gameapisource/ -s ASSERTIONS=0 --use-preload-cache -s NO_EXIT_RUNTIME=1 -s TOTAL_MEMORY=1750Mb -s TOTAL_STACK=20Mb -s WASM=1 --bind -std=c++11 web_page/test.cpp libGameApi.bc -s USE_SDL=2 -s USE_FREETYPE=1 -s DEMANGLE_SUPPORT=1 -L. -Lobs -I. -o web_page/web_page_highmem.html --memory-init-file 0 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s "EXPORTED_RUNTIME_METHODS=['__cxa_is_pointer_type', '__cxa_can_catch','ALLOC_NORMAL', 'ALLOC_STACK', 'ALLOC_DYNAMIC', 'ALLOC_NONE', '_set_new_script', '_activate_trigger', '_stop_music_playing', '_set_toggle_button', '_set_integer', '_set_float', '_set_string', '_set_background_mode', '_set_resize_event', 'cwrap', 'ccall', 'FT_Get_Char_Index', 'FT_Load_Gryph', 'FT_New_Memory_Face', 'FT_Render_Glyph', 'FT_Set_Char_Size', 'emscripten_fetch','emscripten_fetch_attr_init', 'emscripten_fetch_close', '_get_integer']" -s ENVIRONMENT=web,worker -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s FETCH=1 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0 -s DISABLE_EXCEPTION_CATCHING=0)
warning: undefined symbol: $FS (referenced by $PATH_FS__deps: ['$PATH','$FS'], referenced by Mix_LoadWAV_RW__deps: ['$PATH_FS','$SDL'], referenced by Mix_LoadMUS_RW__deps: ['$SDL','Mix_LoadWAV_RW'], referenced by Mix_LoadMUS__deps: ['Mix_LoadMUS_RW','SDL_RWFromFile','SDL_FreeRW','$SDL'], referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z15add_shader_codeRN7GameApi3EnvEP10ShaderCode (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z16find_shader_codeRN7GameApi3EnvENS_3SHCE (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z24add_screenspace_materialRN7GameApi3EnvEP19ScreenSpaceMaterial (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z25find_screenspace_materialRN7GameApi3EnvENS_3SMTE (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z7add_pboRN7GameApi3EnvEP17PixelBufferObject (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z8find_pboRN7GameApi3EnvENS_3PBOE (referenced by top-level compiled C/C++ code)
warning: undefined symbol: glAlphaFunc (referenced by top-level compiled C/C++ code)
warning: undefined symbol: glMapBuffer (referenced by top-level compiled C/C++ code)
warning: undefined symbol: glUnmapBuffer (referenced by top-level compiled C/C++ code)
em++: warning: warnings in JS library compilation [-Wjs-compiler]
em++: warning: running limited binaryen optimizations because DWARF info requested (or indirectly required) [-Wlimited-postlink-optimizations]
#wasm-strip web_page_highmem.wasm
brotli --quality=5 --force web_page_highmem.wasm -o web_page_highmem.wasm.br
make[1]: Poistutaan hakemistosta ”/home/terop/cvs/GameApi/GameApi/web_page”
Full link command and output with -v appended:
Even for runtime issues it helps a lot if you can include the full link command.
Adding -v to the link command will show all of the sub-commands run which
can help us diagnose your issue.
The basic problem is that SDL_PollEvent() is able to write outside of the SDL_Event struct. It only write a one or few bytes...
I solved a significant problem in my 3d engine using the following hack:
struct SDL_EVENT_HACK { SDL_Event e; unsigned int cc; }; SDL_EVENT_HACK h; SDL_Event &e = h.e; int val = ::SDL_PollEvent(&e);
The PollEvent call writes over that unsigned int cc; variable, so that's clearly a bug in SDL2 or clang unions.
Usually this SDL_Event struct is in stack, so if you don't have anything critical in that location in the stack, the bug will be completely invisible.
Please include the following in your bug report:
Version of emscripten/emsdk:
Please include the output
emcc -vhereemcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.23 (5ae63ce)
clang version 16.0.0 (https://github.com/llvm/llvm-project 8b587113b746f31b63fd6473083df78cef30a72e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/terop/cvs/emscripten/emsdk/upstream/bin
Failing command line in full:
If this is compile or link-time failure please include the full failing command
along with its entire output.
Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)
Adding directories to PATH:
PATH += /home/terop/cvs/emscripten/emsdk
PATH += /home/terop/cvs/emscripten/emsdk/upstream/emscripten
PATH += /home/terop/cvs/emscripten/emsdk/node/14.18.2_64bit/bin
Setting environment variables:
PATH = /home/terop/cvs/emscripten/emsdk:/home/terop/cvs/emscripten/emsdk/upstream/emscripten:/home/terop/cvs/emscripten/emsdk/node/14.18.2_64bit/bin:/home/terop/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
EMSDK = /home/terop/cvs/emscripten/emsdk
EM_CONFIG = /home/terop/cvs/emscripten/emsdk/.emscripten
EMSDK_NODE = /home/terop/cvs/emscripten/emsdk/node/14.18.2_64bit/bin/node
make -j 8 -f Makefile.LinuxEm
make[1]: warning: -j8 forced in submake: resetting jobserver mode.
make[1]: Siirrytään hakemistoon ”/home/terop/cvs/GameApi/GameApi”
Deps GameApi_low.cc -o objs/GameApi_low.d
Deps GameApi_main.cc -o objs/GameApi_main.d
em++ GameApi_main.cc -o objs/GameApi_main.bc
em++ GameApi_low.cc -o objs/GameApi_low.bc
echo em++ libGameApi.bc
em++ libGameApi.bc
em++ -shared objs/GameApi_gui.bc objs/GameApi_gltf.bc objs/GameApi_diag.bc objs/Pieces.bc objs/Map.bc objs/VectorTools.bc objs/Effect.bc objs/Buffer.bc objs/Intersect.bc objs/Bitmap.bc objs/Effect2.bc objs/Shader.bc objs/VolumeObjects.bc objs/Tree.bc objs/Event.bc objs/ObjectCreator.bc objs/IntersectObject.bc objs/Graph.bc objs/Widgets.bc objs/Category.bc objs/Plane.bc objs/Coordinates.bc objs/Triangle.bc objs/Game.bc objs/Editor.bc objs/Web.bc objs/Functions.bc objs/ShaderExpr.bc objs/Font.bc objs/FontEditor.bc objs/GameApi.bc objs/GameApiTest.bc objs/Games.bc objs/HierarchyObject.bc objs/Physics.bc objs/GameApiTest2.bc objs/State.bc objs/Serialize.bc objs/KeyFrameEditor.bc objs/Parser.bc objs/FreeType.bc objs/FreeType2.bc objs/VertexArray.bc objs/StateChange.bc objs/DistanceObject.bc objs/GameRunner.bc objs/GameApi_an.bc objs/GameApi_bm.bc objs/GameApi_co.bc objs/GameApi_dr.bc objs/GameApi_ev.bc objs/GameApi_ex.bc objs/GameApi_fbo.bc objs/GameApi_f.bc objs/GameApi_fn.bc objs/GameApi_fnt.bc objs/GameApi_gr.bc objs/GameApi_lay.bc objs/GameApi_li.bc objs/GameApi_main.bc objs/GameApi_mx.bc objs/GameApi_pc.bc objs/GameApi_phy.bc objs/GameApi_pla.bc objs/GameApi_pl.bc objs/GameApi_pt.bc objs/GameApi_pts.bc objs/GameApi_sh.bc objs/GameApi_shm.bc objs/GameApi_sm.bc objs/GameApi_spa.bc objs/GameApi_sp.bc objs/GameApi_st.bc objs/GameApi_su.bc objs/GameApi_tex.bc objs/GameApi_tr.bc objs/GameApi_trk.bc objs/GameApi_tx.bc objs/GameApi_vbo.bc objs/GameApi_ve.bc objs/GameApi_vo.bc objs/GameApi_wmod.bc objs/GameApi_wv.bc objs/GameApi_vx.bc objs/GameApi_cut.bc objs/GameApi_in.bc objs/GameApi_imp.bc objs/GameApi_plane.bc objs/GameApi_integrator.bc objs/Main.bc objs/GameApi_vr.bc objs/GameApi_low.bc objs/GameApi_dep_add_find.bc objs/GameApi_dep_env.bc objs/GameApi_dep_arr_render.bc objs/GameApi_webcam.bc objs/Math2.bc objs/GameApi_cmd_move.bc objs/GameApi_cmd_bbitmap.bc objs/GameApi_cmd_pdfield.bc objs/GameApi_cmd_bitmap.bc objs/GameApi_cmd_point.bc objs/GameApi_cmd_booleanops.bc objs/GameApi_cmd_points.bc objs/GameApi_cmd_cvolume.bc objs/GameApi_cmd_polygon2.bc objs/GameApi_cmd_fbitmap.bc objs/GameApi_cmd_polygon.bc objs/GameApi_cmd_font.bc objs/GameApi_cmd_framebuffer.bc objs/GameApi_cmd_texture.bc objs/GameApi_cmd_fvolume.bc objs/GameApi_cmd_lines.bc objs/GameApi_cmd_vector.bc objs/GameApi_cmd_mainloop.bc objs/GameApi_cmd_volume.bc objs/GameApi_cmd_material.bc objs/GameApi_cmd_waveform.bc objs/GameApi_cmd_shader.bc objs/GameApi_cmd.bc objs/cpushader.bc objs/music.bc objs/music_html5.bc objs/prerequisites.bc -o libGameApi.bc -s ERROR_ON_UNDEFINED_SYMBOLS=0 -Lhssynth2/synthlib/emscripten -lsynthlib -Lhssynth2/midiplay/midifile/emscripten -lmidifilelib
em++: warning: linking a library with
-sharedwill emit a static object file. This is a form of emulation to support existing build systems. If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]make[1]: Poistutaan hakemistosta ”/home/terop/cvs/GameApi/GameApi”
(cd web_page; make -f Makefile.LinuxEm pthreads_both)
make[1]: Siirrytään hakemistoon ”/home/terop/cvs/GameApi/GameApi/web_page”
(cd ..;em++ -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=30 -s FILESYSTEM=0 -g -gsource-map --source-map-base https://meshpage.org/gameapisource/ -s ASSERTIONS=0 --use-preload-cache -s NO_EXIT_RUNTIME=1 -s TOTAL_MEMORY=1750Mb -s TOTAL_STACK=20Mb -s WASM=1 --bind -std=c++11 web_page/test.cpp libGameApi.bc -s USE_SDL=2 -s USE_FREETYPE=1 -s DEMANGLE_SUPPORT=1 -L. -Lobs -I. -o web_page/web_page_highmem.html --memory-init-file 0 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s "EXPORTED_RUNTIME_METHODS=['__cxa_is_pointer_type', '__cxa_can_catch','ALLOC_NORMAL', 'ALLOC_STACK', 'ALLOC_DYNAMIC', 'ALLOC_NONE', '_set_new_script', '_activate_trigger', '_stop_music_playing', '_set_toggle_button', '_set_integer', '_set_float', '_set_string', '_set_background_mode', '_set_resize_event', 'cwrap', 'ccall', 'FT_Get_Char_Index', 'FT_Load_Gryph', 'FT_New_Memory_Face', 'FT_Render_Glyph', 'FT_Set_Char_Size', 'emscripten_fetch','emscripten_fetch_attr_init', 'emscripten_fetch_close', '_get_integer']" -s ENVIRONMENT=web,worker -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s FETCH=1 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0 -s DISABLE_EXCEPTION_CATCHING=0)
warning: undefined symbol: $FS (referenced by $PATH_FS__deps: ['$PATH','$FS'], referenced by Mix_LoadWAV_RW__deps: ['$PATH_FS','$SDL'], referenced by Mix_LoadMUS_RW__deps: ['$SDL','Mix_LoadWAV_RW'], referenced by Mix_LoadMUS__deps: ['Mix_LoadMUS_RW','SDL_RWFromFile','SDL_FreeRW','$SDL'], referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z15add_shader_codeRN7GameApi3EnvEP10ShaderCode (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z16find_shader_codeRN7GameApi3EnvENS_3SHCE (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z24add_screenspace_materialRN7GameApi3EnvEP19ScreenSpaceMaterial (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z25find_screenspace_materialRN7GameApi3EnvENS_3SMTE (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z7add_pboRN7GameApi3EnvEP17PixelBufferObject (referenced by top-level compiled C/C++ code)
warning: undefined symbol: _Z8find_pboRN7GameApi3EnvENS_3PBOE (referenced by top-level compiled C/C++ code)
warning: undefined symbol: glAlphaFunc (referenced by top-level compiled C/C++ code)
warning: undefined symbol: glMapBuffer (referenced by top-level compiled C/C++ code)
warning: undefined symbol: glUnmapBuffer (referenced by top-level compiled C/C++ code)
em++: warning: warnings in JS library compilation [-Wjs-compiler]
em++: warning: running limited binaryen optimizations because DWARF info requested (or indirectly required) [-Wlimited-postlink-optimizations]
#wasm-strip web_page_highmem.wasm
brotli --quality=5 --force web_page_highmem.wasm -o web_page_highmem.wasm.br
make[1]: Poistutaan hakemistosta ”/home/terop/cvs/GameApi/GameApi/web_page”
Full link command and output with
-vappended:Even for runtime issues it helps a lot if you can include the full link command.
Adding
-vto the link command will show all of the sub-commands run whichcan help us diagnose your issue.
The basic problem is that SDL_PollEvent() is able to write outside of the SDL_Event struct. It only write a one or few bytes...
I solved a significant problem in my 3d engine using the following hack:
struct SDL_EVENT_HACK { SDL_Event e; unsigned int cc; }; SDL_EVENT_HACK h; SDL_Event &e = h.e; int val = ::SDL_PollEvent(&e);
The PollEvent call writes over that unsigned int cc; variable, so that's clearly a bug in SDL2 or clang unions.
Usually this SDL_Event struct is in stack, so if you don't have anything critical in that location in the stack, the bug will be completely invisible.