HTML5 build fails because undefined std:: symbols

My HTML5 build of a project containing a 3rd party C++ source including <array>, <vector> and <memory> (all c++ stdlib modules) fails with:

  error: undefined symbol: _ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv
  warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
  error: undefined symbol: __cxa_bad_typeid
  error: undefined symbol: __cxa_guard_acquire
  error: undefined symbol: __cxa_guard_release
  error: undefined symbol: __dynamic_cast
  error: undefined symbol: _ZTVN10__cxxabiv117__class_type_infoE
  error: undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
  error: undefined symbol: _ZTVN10__cxxabiv121__vmi_class_type_infoE
  error: undefined symbol: tzname
  Error: Aborting compilation due to previous errors
  shared:ERROR: '/home/kyra/src/UnrealEngine/Engine/Extras/ThirdPartyNotUE/emsdk/Linux/node/8.9.1_64bit/bin/node /home/kyra/src/UnrealEngine/Engine/Extras/ThirdPartyNotUE/emsdk/emscripten/1.38.20/src/compiler.js /home/kyra/src/UnrealEngine/Engine/Intermediate/Build/HTML5/EmscriptenTemp/tmpmzlhxK.txt /home/kyra/src/UnrealEngine/Engine/Source/Runtime/HTML5/HTML5JS/Private/HTML5JavaScriptFx.js /home/kyra/src/UnrealEngine/Engine/Extras/ThirdPartyNotUE/emsdk/emscripten/1.38.20/src/library_pthread.js' failed (1)
Took 155.912479s to run mono, ExitCode=5

which demangled resolves to:

  • std::__2::__vector_base_common<true>::__throw_length_error() const
  • __cxa_bad_typeid
  • __cxa_guard_acquire
  • __cxa_guard_release
  • __dynamic_cast
  • vtable for __cxxabiv1::__class_type_info
  • vtable for __cxxabiv1::__si_class_type_info
  • vtable for __cxxabiv1::__vmi_class_type_info
  • tzname

and according to emscripten this shouldn’t happen (especially also since i’m never actually including time.h where tzname is declared, also pretty sure the “class type info” things are used for stuff like UClass, not by my code, so this seems to be some underlying issue instead).

does anyone have an idea what’s going on here or how i could fix it?

EDIT: after doing a -clean, removing /Intermediate/Build/HTML5 and rebuilding, now it fails to find a bazillion other stdlib things: UEBuildPlatformSDK.PrintSDKInfo: UnrealBuildTool.MacPlatformSDK using manually i - Pastebin.com

does building a basic template project – with NO extra plugins enabled – work on your development environment? (e.g. blueprint first person)

and then, when adding your wanted plugin – does it still build for html5? the errors are basic and seems there’s something interfering with the packaging.

also, you can turn on verbose build by editing:

.../Engine/Source/Programs/UnrealBuildTool/Platform/HTML5/HTML5ToolChain.cs

and uncommenting:

Environment.SetEnvironmentVariable("EMCC_DEBUG", "1");

(am interested in seeing the linker step…)

hello nonchip,

i have fixed this for 4.22.1 – you can see the solution here:

https://github.com/EpicGames/UnrealEngine/commit/5956a33a84b13e909574ef1a128e2f71b0bf8483