Unity 6000 WebGL build error on using a package

In Unity 6000.0.11f, when using the this package the build throws the the Bee errors undefined symbol. Further versions (2022.3.15f and 2023.1.15f1) does not have this problem.

Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:

D:\Projekte\Unity\_temp\SuperResponsiveGUI>set MYDIR=C:\Program Files\Unity\Hub\Editor\6000.0.11f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\ 

D:\Projekte\Unity\_temp\SuperResponsiveGUI>goto FOUND_MYDIR 
wasm-ld: error: Library/PackageCache/com.gilzoide.flex-ui/Plugins/build/webgl/libflex-ui.bc: undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const
wasm-ld: error: Library/PackageCache/com.gilzoide.flex-ui/Plugins/build/webgl/libflex-ui.bc: undefined symbol: std::__2::__vector_base_common<true>::__throw_out_of_range() const
emcc: error: '"C:/Program Files/Unity/Hub/Editor/6000.0.11f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/llvm\wasm-ld.exe" @C:\Users\Rob\AppData\Local\Temp\emscripten_zp6fwbeo.rsp.utf-8' failed (returned 1)

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Build completed with a result of 'Failed' in 30 seconds (30201 ms)
Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:

D:\Projekte\Unity\_temp\SuperResponsiveGUI>set MYDIR=C:\Program Files\Unity\Hub\Editor\6000.0.11f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\ 

D:\Projekte\Unity\_temp\SuperResponsiveGUI>goto FOUND_MYDIR 
wasm-ld: error: Library/PackageCache/com.gilzoide.flex-ui/Plugins/build/webgl/libflex-ui.bc: undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const
wasm-ld: error: Library/PackageCache/com.gilzoide.flex-ui/Plugins/build/webgl/libflex-ui.bc: undefined symbol: std::__2::__vector_base_common<true>::__throw_out_of_range() const
emcc: error: '"C:/Program Files/Unity/Hub/Editor/6000.0.11f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/llvm\wasm-ld.exe" @C:\Users\Rob\AppData\Local\Temp\emscripten_zp6fwbeo.rsp.utf-8' failed (returned 1)

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Steps to reproduce:

  1. Open (new) project
  2. Install the upm package: projectpath> openupm add com.gilzoide.flex-ui
  3. Add UI Image (UGUI) (including Canvas and Eventsystem) to scene.
  4. Add Component FlexLayout.cs to image
  5. Save scene
  6. Build scene in WebGL
  7. → error appears

Hi,

Unity 6000.0 added some new WebAssembly/emscripten features that might be incompatible with the pre-compiled plugin. It might be possible to make it work by disabling some of the features.
Can you share your Build Profile > Platform Settings > WebGL Settings and Player Settings > Publishing Settings?

Some settings that could cause the incompatibility are:

  • Code Optimization set to either Runtime Speed With LTO or Disk Size With LTO
  • Target WebAssembly 2023 set to enabled
  • Use WebAssembly.Table set to enabled
  • Enable Native C/C++ Multithreading set to enabled
  • Enable BigInt set to enabled
  • Enable Exceptions set to None

If changing these settings does not help it would be necessary for the creator of the package to recompile the Web plugin with the new version of emscripten used by Unity 6000.0.