Skip to content

TypeError (sig undefined) when enabling dynamic linking with -sMAIN_MODULE=2 #22431

Closed

Description

@plagunas2

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64
clang version 19.0.0git (https:/github.com/llvm/llvm-project 4d8e42ea6a89c73f90941fd1b6e899912e31dd34)
Target: wasm32-unknown-emscripten
Thread model: posix

I am trying to port Speed Dreams 2.2.1 with Emscripten on Ubuntu using the game's cmake. Unfortunately, the game relies heavily on loading shared libraries/modules using dlopen; building it statically allowed the game to start initializing on the browser, but failed when attempting to load the menu and other things (which are expected to be built as shared libraries). I've attempted building the game with dynamic linking enabled like so:

I referred to #16281 to enable automatic dynamic linking of shared libraries (as side modules). After some issues with duplicate symbols in some libraries and the main executable, I included -sSIDE_MODULE=2 and set main executable to use -sMAIN_MODULE=2, which seemed to fix the issue. For some reason, I was having issues with mismatched types (WASM_SYMBOL_TYPE_SECTION vs WASM_SYMBOL_TYPE_FUNCTION) with a certain library; building it statically resolved this (this library is never loaded with dlopen).

Main module

IF(EMSCRIPTEN)
	link_directories(${CMAKE_BINARY_DIR}/lib/games/speed-dreams-2/lib)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
ENDIF(EMSCRIPTEN)

SD_ADD_EXECUTABLE(${_TARGET_NAME} ${_SOURCES})

IF(EMSCRIPTEN)
	set(CMAKE_EXECUTABLE_SUFFIX ".html")
	set_target_properties(${_TARGET_NAME} PROPERTIES LINK_FLAGS "-sMAIN_MODULE=2 --preload-file ../../data")
ENDIF(EMSCRIPTEN)

When running the generated html, wasm, and js on a browser, I get this:

Chrome

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'slice')
at generateFuncType (speed-dreams-2.js:1:106138)
at convertJsFunctionToWasm (speed-dreams-2.js:1:106590)
at addFunction (speed-dreams-2.js:1:193354)
at reportUndefinedSymbols (speed-dreams-2.js:1:116925)
at loadDylibs (speed-dreams-2.js:1:117131)
at receiveInstance (speed-dreams-2.js:1:92954)
at receiveInstantiationResult (speed-dreams-2.js:1:93212)

Firefox

Uncaught (in promise) TypeError: sig is undefined
generateFuncType (http://localhost:8000/speed-dreams-2.js:1)
convertJsFunctionToWasm (http://localhost:8000/speed-dreams-2.js:1)
addFunction (http://localhost:8000/speed-dreams-2.js:1)
reportUndefinedSymbols (http://localhost:8000/speed-dreams-2.js:1)
loadDylibs (http://localhost:8000/speed-dreams-2.js:1)
receiveInstance (http://localhost:8000/speed-dreams-2.js:1)
receiveInstantiationResult (http://localhost:8000/speed-dreams-2.js:1)

The identified js code

var generateFuncType = (sig,target)=>{
    var sigRet = sig.slice(0, 1); //sig typeError here
    var sigParam = sig.slice(1); 
    var typeCodes = {
        i: 127,
        p: 127,
        j: 126,
        f: 125,
        d: 124,
        e: 111
    };
    target.push(96);
    uleb128Encode(sigParam.length, target);
    for (var i = 0; i < sigParam.length; ++i) {
        target.push(typeCodes[sigParam[i]])
    }
    if (sigRet == "v") {
        target.push(0)
    } else {
        target.push(1, typeCodes[sigRet])
    }
}

I'm getting the same issue when building Speed Dreams 2.3 on windows with dynamic linking enabled and sERROR_ON_UNDEFINED_SYMBOLS=0 in the main.cpp cmake file. Not entirely sure what the issue may be since I'm fairly new to Emscripten. Is a function not being properly defined somewhere in the wasm or js file?

Activity

  1. kripken commented on Aug 22, 2024

    @kripken
    Member

    This sounds like an unknown dynamic linking bug. Specifically from that call stack it sounds like sig is not filled in when addFunction is called from the dylink code, which is not valid.

    @sbc100 is this a known issue?

  2. sbc100 commented on Aug 22, 2024

    @sbc100
    Collaborator

    Can you catch the error in the debugger and see what addFunction is being called with?

    I looks like there is an assertion in addFunction to check that the given function has .sig attribute which you should be hitting? Are you running with -sASSERTIONS (or without passing -O1 or above at link time which has the same effect)?

  3. plagunas2 commented on Aug 23, 2024

    @plagunas2
    Author

    When running with -sASSERTIONS:

    Aborted(Assertion failed: Missing signature argument to addFunction: program=>{if(GL.currProgram!=program){GLImmediate.currentRenderer=null;GL.currProgram=program;GLImmediate.fixedFunctionProgram=0;glUseProgram(program)}})
    

    The function

    var glUseProgram = _glUseProgram;
            _glUseProgram = _emscripten_glUseProgram = program=>{
                if (GL.currProgram != program) {
                    GLImmediate.currentRenderer = null;
                    GL.currProgram = program;
                    GLImmediate.fixedFunctionProgram = 0;
                    glUseProgram(program)
                }
            }
            ;

    This is also nested within

    var GLEmulation = {

    I do have gl emulation enabled since the game (at least version 2.2.1) uses openGL 1.3. glUseProgram does not have .sig, but _emscripten_glUseProgram does:

    var _emscripten_glUseProgram = _glUseProgram;
    _emscripten_glUseProgram.sig = "vi";

    Is this mainly a gl emulation issue or emulation + dynamic linking?

  4. sbc100 commented on Aug 23, 2024

    @sbc100
    Collaborator

    Great, that provides a lot of info to go on. Can you perhaps share the full set of link flags you are using?

  5. plagunas2 commented on Aug 26, 2024

    @plagunas2
    Author

    The main executable with -v:

    [100%] Linking CXX executable ../../games/speed-dreams-2.html
     /home/priscilla/emsdk/upstream/bin/clang --version
     /home/priscilla/emsdk/upstream/emscripten/tools/file_packager ../../games/speed-dreams-2.data --from-emcc --preload ../../data
     /home/priscilla/emsdk/upstream/bin/wasm-ld -o ../../games/speed-dreams-2.wasm CMakeFiles/speed-dreams-2.dir/main.cpp.o -L/home/priscilla/speed-dreams-2.2.1/finalBuild/lib/games/speed-dreams-2/lib ../libs/portability/libportability.a ../libs/tgf/libtgf.a ../libs/tgfclient/libtgfclient.a ../libs/tgfdata/libtgfdata.a ../modules/networking/libnetworking.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/static/libenet.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsl.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libpng.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libz.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libjpeg.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbis.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbisfile.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libogg.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsl.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libpng.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libz.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libjpeg.a -L/home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbis.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbisfile.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libogg.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibjs.a ../libs/tgf/libtgf.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libSDL2.a ../libs/txml/libtxml.a ../libs/portability/libportability.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibul.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsg.a -lGL-emu-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpj1bado20libemscripten_js_symbols.so --import-memory --strip-debug --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_set_limits --export=emscripten_stack_alloc --export=get_temp_ret --export=set_temp_ret --export=wasm_call_ctors --export=setThrew --export=_emscripten_stack_restore --export=malloc --export=strerror --export-if-defined=start_em_asm --export-if-defined=stop_em_asm --export-if-defined=start_em_lib_deps --export-if-defined=stop_em_lib_deps --export-if-defined=start_em_js --export-if-defined=stop_em_js --export-if-defined=main --export-if-defined=main_argc_argv --export-if-defined=_wasm_apply_data_relocs --export-if-defined=fflush --experimental-pic --unresolved-symbols=import-dynamic --no-shlib-sigcheck -pie --no-export-dynamic -z stack-size=65536 --no-growable-memory --initial-memory=16777216 --no-entry
     /home/priscilla/emsdk/upstream/bin/llvm-objcopy ../../games/speed-dreams-2.wasm ../../games/speed-dreams-2.wasm --remove-section=.debug* --remove-section=producers
     /home/priscilla/emsdk/upstream/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-export-originals --pass-arg=legalize-js-interface-exported-helpers --check-stack-overflow ../../games/speed-dreams-2.wasm -o ../../games/speed-dreams-2.wasm --detect-features
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/src/compiler.mjs /tmp/tmpy8zr8pn4.json
     /home/priscilla/emsdk/upstream/bin/wasm-opt --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable ../../games/speed-dreams-2.wasm -o ../../games/speed-dreams-2.wasm --mvp-features --enable-multivalue --enable-mutable-globals --enable-reference-types --enable-sign-ext
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_3bzcrane/speed-dreams-2.js JSDCE --minify-whitespace -o /tmp/emscripten_temp_3bzcrane/speed-dreams-2.jso1.js
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/tools/preprocessor.mjs /tmp/emscripten_temp_3bzcrane/settings.js shell.html
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/node_modules/.bin/html-minifier-terser ../../games/speed-dreams-2.html -o ../../games/speed-dreams-2.html --collapse-whitespace --collapse-inline-tag-whitespace --remove-comments --remove-tag-whitespace --sort-attributes --sort-class-name --decode-entities --collapse-boolean-attributes --remove-attribute-quotes --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --use-short-doctype --minify-css true --minify-js true
    

    Many of these were automatically included by Emscripten as I only really explicitly specified pic, gl emulation, --preload-data, sMain_module, and generating an html output.

    Some additional info: forgot to mention this earlier, but I did build other libraries that were not loaded with dlopen as static. Everything loaded with dlopen was built as -sSide_Module=2. However, my Speed Dreams build on windows with the same problem was built completely as shared (so I'm guessing this isn't an issue with mixing static and shared).

    If this helps, here are the link flags for the windows build:

    [ 91%] Linking CXX executable ..\..\games\speed-dreams-2.html
     "C:/Users/prisc/emsdk/upstream/bin\clang.exe" --version
    em++: warning: ignoring unsupported linker flag: `--allow-shlib-undefined` [-Wlinkflags]
     "C:\Users\prisc\emsdk\upstream\emscripten\tools\file_packager.bat" ..\..\games\speed-dreams-2.data --from-emcc --preload ../../data
     "C:/Users/prisc/emsdk/upstream/bin\wasm-ld.exe" -o ..\..\games\speed-dreams-2.wasm -E CMakeFiles/speed-dreams-2.dir/main.cpp.o -LD:/speed-dreams-code-2.3/build-emsdk/lib/games/speed-dreams-2/lib -LC:\Users\prisc\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\pic ../../lib/games/speed-dreams-2/lib/libtgfclient.so ../../lib/games/speed-dreams-2/lib/libtgfdata.so C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libpng.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libz.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/liblibjpeg.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libSDL2_mixer.a ../../lib/games/speed-dreams-2/lib/libtgf.so C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libSDL2main.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libSDL2.a ../../lib/games/speed-dreams-2/lib/libtxml.so ../../lib/games/speed-dreams-2/lib/libportability.so C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libplibul.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsg.a -lGL-emu-getprocaddr -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --export-if-defined=setThrew --export-if-defined=_emscripten_stack_restore --export-if-defined=emscripten_stack_get_current --export-if-defined=_emscripten_tempret_set --export-if-defined=malloc --export-if-defined=_emscripten_stack_alloc --export-if-defined=_emscripten_tempret_get --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=htonl --export-if-defined=_emscripten_timeout --export-if-defined=__cxa_is_pointer_type --export-if-defined=free --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=fileno --export-if-defined=emscripten_builtin_memalign --export-if-defined=__dl_seterr --export-if-defined=memcmp --export-if-defined=memcpy --export-if-defined=__errno_location --export-if-defined=__cxa_demangle C:\Users\prisc\AppData\Local\Temp\tmp89sskgm6libemscripten_js_symbols.so --import-undefined --import-memory --strip-debug --export-if-defined=_emscripten_stack_alloc --export-if-defined=__get_temp_ret --export-if-defined=__set_temp_ret --export-if-defined=__wasm_call_ctors --export-if-defined=setThrew --export-if-defined=_emscripten_stack_restore --export-if-defined=emscripten_stack_get_current --export-if-defined=_emscripten_tempret_set --export-if-defined=malloc --export-if-defined=_emscripten_tempret_get --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=htonl --export-if-defined=_emscripten_timeout --export-if-defined=__cxa_is_pointer_type --export-if-defined=free --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=fileno --export-if-defined=emscripten_builtin_memalign --export-if-defined=__dl_seterr --export-if-defined=memcmp --export-if-defined=memcpy --export-if-defined=__errno_location --export-if-defined=__cxa_demangle --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm --export-if-defined=_ZNSt3__26__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEiEENS_19__map_value_compareIS7_S8_NS_4lessIS7_EELb1EEENS5_IS8_EEE12__find_equalIS7_EERPNS_16__tree_node_baseIPvEENS_21__tree_const_iteratorIS8_PNS_11__tree_nodeIS8_SH_EElEERPNS_15__tree_end_nodeISJ_EESK_RKT_ --export-if-defined=_ZNSt3__26__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEiEENS_19__map_value_compareIS7_S8_NS_4lessIS7_EELb1EEENS5_IS8_EEE30__emplace_hint_unique_key_argsIS7_JRKNS_4pairIKS7_iEEEEENSG_INS_15__tree_iteratorIS8_PNS_11__tree_nodeIS8_PvEElEEbEENS_21__tree_const_iteratorIS8_SP_lEERKT_DpOT0_ --export-if-defined=_ZdlPvm --export-if-defined=_Znwm --export-if-defined=__cxa_atexit --export-if-defined=__memory_base --export-if-defined=__stack_pointer --export-if-defined=__table_base --export-if-defined=clock --export-if-defined=effectCurTime --export-if-defined=effectStart --export-if-defined=forceFeedback --export-if-defined=mapSDL2Players --export-if-defined=memcmp --export-if-defined=memset --export-if-defined=_ZN6GfRace7Private11vecstrEmptyE --export-if-defined=_ZN6GfRace7Private8strEmptyE --export-if-defined=GfOs --export-if-defined=GfPLogDefault --export-if-defined=_ZN8GfModule20_mapModulesByLibNameE --export-if-defined=fflush --export-if-defined=fiprintf --export-if-defined=free --export-if-defined=gfMapLoggersByName --export-if-defined=log --export-if-defined=logf --export-if-defined=malloc --export-if-defined=memcpy --export-if-defined=memmove --export-if-defined=snprintf --export-if-defined=strcat --export-if-defined=strcmp --export-if-defined=strcpy --export-if-defined=strdup --export-if-defined=strlen --export-if-defined=strrchr --export-if-defined=vfprintf --experimental-pic --unresolved-symbols=import-dynamic -pie --no-export-dynamic -z stack-size=65536 --no-growable-memory --initial-memory=16777216 --no-entry
     "C:/Users/prisc/emsdk/upstream/bin\wasm-ld.exe" -o ..\..\games\speed-dreams-2.wasm --whole-archive -E CMakeFiles/speed-dreams-2.dir/main.cpp.o -LD:/speed-dreams-code-2.3/build-emsdk/lib/games/speed-dreams-2/lib -LC:\Users\prisc\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\pic ../../lib/games/speed-dreams-2/lib/libtgfclient.so ../../lib/games/speed-dreams-2/lib/libtgfdata.so C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libpng.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libz.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/liblibjpeg.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libSDL2_mixer.a ../../lib/games/speed-dreams-2/lib/libtgf.so C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libSDL2main.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libSDL2.a ../../lib/games/speed-dreams-2/lib/libtxml.so ../../lib/games/speed-dreams-2/lib/libportability.so C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libplibul.a C:/Users/prisc/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsg.a -lGL-emu-getprocaddr -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --export-if-defined=setThrew --export-if-defined=_emscripten_stack_restore --export-if-defined=emscripten_stack_get_current --export-if-defined=_emscripten_tempret_set --export-if-defined=malloc --export-if-defined=_emscripten_stack_alloc --export-if-defined=_emscripten_tempret_get --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=htonl --export-if-defined=_emscripten_timeout --export-if-defined=__cxa_is_pointer_type --export-if-defined=free --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=fileno --export-if-defined=emscripten_builtin_memalign --export-if-defined=__dl_seterr --export-if-defined=memcmp --export-if-defined=memcpy --export-if-defined=__errno_location --export-if-defined=__cxa_demangle C:\Users\prisc\AppData\Local\Temp\tmpzudr5_9tlibemscripten_js_symbols.so --import-undefined --import-memory --strip-debug --export-dynamic --export-if-defined=_emscripten_stack_alloc --export-if-defined=__get_temp_ret --export-if-defined=__set_temp_ret --export-if-defined=__wasm_call_ctors --export-if-defined=setThrew --export-if-defined=_emscripten_stack_restore --export-if-defined=emscripten_stack_get_current --export-if-defined=_emscripten_tempret_set --export-if-defined=malloc --export-if-defined=_emscripten_tempret_get --export-if-defined=htons --export-if-defined=ntohs --export-if-defined=htonl --export-if-defined=_emscripten_timeout --export-if-defined=__cxa_is_pointer_type --export-if-defined=free --export-if-defined=__cxa_can_catch --export-if-defined=__cxa_increment_exception_refcount --export-if-defined=__cxa_decrement_exception_refcount --export-if-defined=fileno --export-if-defined=emscripten_builtin_memalign --export-if-defined=__dl_seterr --export-if-defined=memcmp --export-if-defined=memcpy --export-if-defined=__errno_location --export-if-defined=__cxa_demangle --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=__wasm_apply_data_relocs --export-if-defined=_ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE25__init_copy_ctor_externalEPKcm --export-if-defined=_ZNSt3__26__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEiEENS_19__map_value_compareIS7_S8_NS_4lessIS7_EELb1EEENS5_IS8_EEE12__find_equalIS7_EERPNS_16__tree_node_baseIPvEENS_21__tree_const_iteratorIS8_PNS_11__tree_nodeIS8_SH_EElEERPNS_15__tree_end_nodeISJ_EESK_RKT_ --export-if-defined=_ZNSt3__26__treeINS_12__value_typeINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEiEENS_19__map_value_compareIS7_S8_NS_4lessIS7_EELb1EEENS5_IS8_EEE30__emplace_hint_unique_key_argsIS7_JRKNS_4pairIKS7_iEEEEENSG_INS_15__tree_iteratorIS8_PNS_11__tree_nodeIS8_PvEElEEbEENS_21__tree_const_iteratorIS8_SP_lEERKT_DpOT0_ --export-if-defined=_ZdlPvm --export-if-defined=_Znwm --export-if-defined=__cxa_atexit --export-if-defined=__memory_base --export-if-defined=__stack_pointer --export-if-defined=__table_base --export-if-defined=clock --export-if-defined=effectCurTime --export-if-defined=effectStart --export-if-defined=forceFeedback --export-if-defined=mapSDL2Players --export-if-defined=memcmp --export-if-defined=memset --export-if-defined=_ZN6GfRace7Private11vecstrEmptyE --export-if-defined=_ZN6GfRace7Private8strEmptyE --export-if-defined=GfOs --export-if-defined=GfPLogDefault --export-if-defined=_ZN8GfModule20_mapModulesByLibNameE --export-if-defined=fflush --export-if-defined=fiprintf --export-if-defined=free --export-if-defined=gfMapLoggersByName --export-if-defined=log --export-if-defined=logf --export-if-defined=malloc --export-if-defined=memcpy --export-if-defined=memmove --export-if-defined=snprintf --export-if-defined=strcat --export-if-defined=strcmp --export-if-defined=strcpy --export-if-defined=strdup --export-if-defined=strlen --export-if-defined=strrchr --export-if-defined=vfprintf --experimental-pic --unresolved-symbols=import-dynamic -pie -z stack-size=65536 --no-growable-memory --initial-memory=16777216 --no-entry
     "C:/Users/prisc/emsdk/upstream/bin\llvm-objcopy.exe" ..\..\games\speed-dreams-2.wasm ..\..\games\speed-dreams-2.wasm --remove-section=.debug* --remove-section=producers
     "C:/Users/prisc/emsdk/upstream\bin\wasm-emscripten-finalize" --dyncalls-i64 --pass-arg=legalize-js-interface-export-originals --pass-arg=legalize-js-interface-exported-helpers ..\..\games\speed-dreams-2.wasm -o ..\..\games\speed-dreams-2.wasm --detect-features
     "C:/Users/prisc/emsdk/node/18.20.3_64bit/bin/node.exe" C:\Users\prisc\emsdk\upstream\emscripten\src\compiler.mjs C:\Users\prisc\AppData\Local\Temp\tmpu1er4vi1.json
    warning: undefined symbol: _Z12GfParmGetStrPvPKcS1_S1_ (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _Z15GfTraceShutdownv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _Z19GfParmReadFileLocalPKcib (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _Z9GfDataDirv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN11GfEventLoopC1Ev (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplication12setEventLoopEP11GfEventLoop (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplication14registerOptionERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_b (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplication18updateUserSettingsEv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplication24addOptionsHelpSyntaxLineERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplication25addOptionsHelpExplainLineERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplication9eventLoopEv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfApplicationC1EPKcS1_S1_ (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN13GfuiEventLoopC1Ev (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN15GfuiApplication11setupWindowEbiii (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN15GfuiApplicationC1EPKcS1_S1_ (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN6GfData10initializeEv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN6GfData8shutdownEv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN8GfLogger4infoEPKcz (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN8GfLogger5errorEPKcz (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN8GfModule4loadERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_ (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZN8GfModule6unloadERPS_ (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZNK13GfApplication4nameEv (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZNK13GfApplication9hasOptionERKNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_ (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZTI13GfApplication (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZTI15GfuiApplication (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: _ZTI8GfModule (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_clear (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_comment (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_info (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_open_callbacks (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_pcm_seek (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_pcm_tell (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_pcm_total (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_read (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_time_seek (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_time_tell (referenced by root reference (e.g. compiled C/C++ code))
    warning: undefined symbol: ov_time_total (referenced by root reference (e.g. compiled C/C++ code))
    em++: warning: warnings in JS library compilation [-Wjs-compiler]
     "C:/Users/prisc/emsdk/upstream\bin\wasm-opt" --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable ..\..\games\speed-dreams-2.wasm -o ..\..\games\speed-dreams-2.wasm --mvp-features --enable-multivalue --enable-mutable-globals --enable-sign-ext
     "C:/Users/prisc/emsdk/node/18.20.3_64bit/bin/node.exe" C:\Users\prisc\emsdk\upstream\emscripten\tools\acorn-optimizer.mjs C:\Users\prisc\AppData\Local\Temp\emscripten_temp_y4s19_8h\speed-dreams-2.js --minify-whitespace -o C:\Users\prisc\AppData\Local\Temp\emscripten_temp_y4s19_8h\speed-dreams-2.jso1.js
     "C:/Users/prisc/emsdk/node/18.20.3_64bit/bin/node.exe" C:\Users\prisc\emsdk\upstream\emscripten\tools\preprocessor.mjs C:\Users\prisc\AppData\Local\Temp\emscripten_temp_y4s19_8h\settings.js shell.html
     "C:\Users\prisc\emsdk\upstream\emscripten\node_modules\.bin\html-minifier-terser.cmd" ..\..\games\speed-dreams-2.html -o ..\..\games\speed-dreams-2.html --collapse-whitespace --collapse-inline-tag-whitespace --remove-comments --remove-tag-whitespace --sort-attributes --sort-class-name --decode-entities --collapse-boolean-attributes --remove-attribute-quotes --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --use-short-doctype --minify-css true --minify-js true
    
  6. sbc100 commented on Aug 26, 2024

    @sbc100
    Collaborator

    Sadly cmake is hiding the actual emcc command here. Can you run your make command with VERBOSE=1?

    Can you explain why you have a different/specific "windows" build. Emscripten should work exactly the same whichever platform it runs on an produce identical results, but maybe I'm missing something here?

  7. plagunas2 commented on Aug 27, 2024

    @plagunas2
    Author

    Ah, I started attempting to build Speed Dreams on windows, but changed over to Ubuntu to build a dependency with emconfigure and decided to stay there haha, nothing specifically to do with Emscripten. The game version is also different because I wanted to try out a version with less dependencies to worry about. I only returned to the windows build to see if the issue was related to the game's 2.2.1 code or if it was purely an Emscripten thing, hope that explains it! I'll refer to the Ubuntu build from now on :)

    Here's Make with VERBOSE=1:

    [100%] Linking CXX executable ../../games/speed-dreams-2.html
    cd /home/priscilla/speed-dreams-2.2.1/finalBuild/src/main && /usr/bin/cmake -E cmake_link_script CMakeFiles/speed-dreams-2.dir/link.txt --verbose=1
    /home/priscilla/emsdk/upstream/emscripten/em++ -sLEGACY_GL_EMULATION -fPIC -sASSERTIONS=2 -fPIC -O3 -DNDEBUG  -v -sMAIN_MODULE=2 --preload-file ../../data @CMakeFiles/speed-dreams-2.dir/objects1.rsp -o ../../games/speed-dreams-2.html @CMakeFiles/speed-dreams-2.dir/linkLibs.rsp
     /home/priscilla/emsdk/upstream/bin/clang --version
     /home/priscilla/emsdk/upstream/emscripten/tools/file_packager ../../games/speed-dreams-2.data --from-emcc --preload ../../data
     /home/priscilla/emsdk/upstream/bin/wasm-ld -o ../../games/speed-dreams-2.wasm CMakeFiles/speed-dreams-2.dir/main.cpp.o -L/home/priscilla/speed-dreams-2.2.1/finalBuild/lib/games/speed-dreams-2/lib ../libs/portability/libportability.a ../libs/tgf/libtgf.a ../libs/tgfclient/libtgfclient.a ../libs/tgfdata/libtgfdata.a ../modules/networking/libnetworking.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/static/libenet.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsl.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libpng.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libz.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libjpeg.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbis.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbisfile.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libogg.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsl.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libpng.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libz.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libjpeg.a -L/home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbis.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libvorbisfile.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libogg.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibjs.a ../libs/tgf/libtgf.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/libSDL2.a ../libs/txml/libtxml.a ../libs/portability/libportability.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibul.a /home/priscilla/emsdk/upstream/emscripten/cache/sysroot/lib/libplibsg.a -lGL-emu-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmp9irit9oelibemscripten_js_symbols.so --import-memory --strip-debug --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_set_limits --export=emscripten_stack_alloc --export=get_temp_ret --export=set_temp_ret --export=wasm_call_ctors --export=setThrew --export=_emscripten_stack_restore --export=malloc --export=strerror --export-if-defined=start_em_asm --export-if-defined=stop_em_asm --export-if-defined=start_em_lib_deps --export-if-defined=stop_em_lib_deps --export-if-defined=start_em_js --export-if-defined=stop_em_js --export-if-defined=main --export-if-defined=main_argc_argv --export-if-defined=_wasm_apply_data_relocs --export-if-defined=fflush --experimental-pic --unresolved-symbols=import-dynamic --no-shlib-sigcheck -pie --no-export-dynamic -z stack-size=65536 --no-growable-memory --initial-memory=16777216 --no-entry
     /home/priscilla/emsdk/upstream/bin/llvm-objcopy ../../games/speed-dreams-2.wasm ../../games/speed-dreams-2.wasm --remove-section=.debug* --remove-section=producers
     /home/priscilla/emsdk/upstream/bin/wasm-emscripten-finalize --dyncalls-i64 --pass-arg=legalize-js-interface-export-originals --pass-arg=legalize-js-interface-exported-helpers --check-stack-overflow ../../games/speed-dreams-2.wasm -o ../../games/speed-dreams-2.wasm --detect-features
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/src/compiler.mjs /tmp/tmp86ulbb2b.json
     /home/priscilla/emsdk/upstream/bin/wasm-opt --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable ../../games/speed-dreams-2.wasm -o ../../games/speed-dreams-2.wasm --mvp-features --enable-multivalue --enable-mutable-globals --enable-reference-types --enable-sign-ext
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/tools/acorn-optimizer.mjs /tmp/emscripten_temp_tbcpt_tk/speed-dreams-2.js JSDCE --minify-whitespace -o /tmp/emscripten_temp_tbcpt_tk/speed-dreams-2.jso1.js
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/tools/preprocessor.mjs /tmp/emscripten_temp_tbcpt_tk/settings.js shell.html
     /home/priscilla/emsdk/node/18.20.3_64bit/bin/node /home/priscilla/emsdk/upstream/emscripten/node_modules/.bin/html-minifier-terser ../../games/speed-dreams-2.html -o ../../games/speed-dreams-2.html --collapse-whitespace --collapse-inline-tag-whitespace --remove-comments --remove-tag-whitespace --sort-attributes --sort-class-name --decode-entities --collapse-boolean-attributes --remove-attribute-quotes --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --use-short-doctype --minify-css true --minify-js true
    make[2]: Leaving directory '/home/priscilla/speed-dreams-2.2.1/finalBuild
    

    Btw, thanks for your patience and responsiveness!

  8. added 3 commits that reference this issue on Aug 27, 2024
    676c3d1
    159931b
    29fe383
  9. sbc100 commented on Aug 27, 2024

    @sbc100
    Collaborator

    Fix for the missing sig issue is in #22456.

    The other issue here looks like undefined symbols at link time. If that issue persists perhaps open a separate issue?

  10. added 3 commits that reference this issue on Aug 27, 2024
    ded397b
    e7284d3
    2a87c73
  11. added a commit that references this issue on Aug 27, 2024
    c6cabd5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions