Error when deploying for WebGL

I'm working on an Oculus Quest VR project using the following stack:
  • MacOS Catilina
  • Unity 2020.1
  • PUN2 Free

When deploying for Quest or Desktop the app works well, but when I deploy for WebGL and try to run the page I get the following error in the browser:
Uncaught abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at Error
    at jsStackTrace (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:22313)
    at Object.stackTrace (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:22484)
    at Object.onAbort (http://127.0.0.1:8000/Build/UnityLoader.js:4:11118)
    at abort (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:557852)
    at _dlopen (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:186247)
    at <anonymous>:wasm-function[74483]:0x16b5f3e
    at <anonymous>:wasm-function[75933]:0x16f5d68
    at <anonymous>:wasm-function[66821]:0x14a1228
    at <anonymous>:wasm-function[66993]:0x14a42ac
    at <anonymous>:wasm-function[36156]:0xe47c6c
    at <anonymous>:wasm-function[36154]:0xe46be4
    at <anonymous>:wasm-function[36151]:0xe46adc
    at <anonymous>:wasm-function[36150]:0xe464ee
    at <anonymous>:wasm-function[29198]:0xd15526
    at dynCall_iiiii (<anonymous>:wasm-function[77085]:0x172d911)
    at Object.dynCall_iiiii (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:522390)
    at invoke_iiiii (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:363788)
    at <anonymous>:wasm-function[75093]:0x16d32b7
    at <anonymous>:wasm-function[74403]:0x16b2aa4
    at <anonymous>:wasm-function[5211]:0x249e9d
    at <anonymous>:wasm-function[5210]:0x249dc6
    at <anonymous>:wasm-function[8858]:0x388679
    at <anonymous>:wasm-function[8855]:0x38749b
    at <anonymous>:wasm-function[11318]:0x490583
    at <anonymous>:wasm-function[9169]:0x3ae0f4
    at <anonymous>:wasm-function[11703]:0x4bc8eb
    at <anonymous>:wasm-function[11414]:0x499bc6
    at <anonymous>:wasm-function[11414]:0x499bdb
    at <anonymous>:wasm-function[11409]:0x4996e4
    at <anonymous>:wasm-function[11402]:0x4976c3
    at dynCall_v (<anonymous>:wasm-function[77111]:0x172ddc4)
    at Object.dynCall_v (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:535693)
    at browserIterationFunc (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:190486)
    at Object.runIter (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:193547)
    at Browser_mainLoop_runner (blob:http://127.0.0.1:8000/c9e045eb-6027-49e5-8d61-c2182c9a7b47:8:192009)

After posting on the Unity forum, somebody in the Unity team replied with a reference to Photon (although the message what was about somebody getting the same kind of error due to SQL lite):
The issue is that SQLite plugin attempts to dynamically load code on the web, which is not possible in Unity WebAssembly builds. To fix this, SQLite authors should update their plugin to be WebGL friendly by statically linking in all the needed code.

The same goes for other plugins (Photon, mujoco, etc.)

The error message that was present with the crash "To use dlopen, you need to use Emscripten's linking support, see ..." was awkward since the Emscripten compiler is at too low level to understand the root issue. The dynamic linking support in Emscripten has too many drawbacks to be feasible to be used at large scale like Unity is.

Are there some specific settings I am missing?

Comments

  • Tobias
    Tobias admin
    edited November 2020
    Is this a new one? Cause it was not a problem so far. There is no new dynamic code since a while.
    Unity 2017.4.7 exports a project with the Photon dll just fine, so maybe it's some other dll or something new in 2020.1 exports?!

    Please link to the discussion in the Unity forum.
  • It has been like that for while, I'm not sure. I have updated all the libraries and Unity but it still happens. Here' the link to the Unity forum thread: https://forum.unity.com/threads/to-use-dlopen-you-need-to-use-emscriptens-linking-support.521968/
  • Any advice?
  • Sorry for not properly following up.
    I posted in the Unity forum thread what we do and asked Jukka from Unity if we can avoid it easily.
    If you are OK to test a DLL with a potential workaround, let us know via mail: developer@photonengine.com. Please include a link to this topic for me to know the context. I would then mail you a test variant.
  • EnigmaSystems
    edited December 2020
    Thanks for your response, I will keep an eye on both thread. More than happy to test the solution but I'm currenty using Unity on Mac so I don't think a DLL would be a viable solution for me. Any other option?
  • It's a C# dll. This is fine for use in Unity on any platform.
  • Sorry for the misunderstanding, we will try your solution and let you know.