Search Unity

need to build with DLOPEN_SUPPORT=1 to get dlopen support in asm.js

Discussion in 'Web' started by hyperhippo, Mar 27, 2015.

  1. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    My WebGL project shows this message in the javascript console right before an exception that is blocking my game from running.

    "need to build with DLOPEN_SUPPORT=1 to get dlopen support in asm.js"

    followed by...

    "warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"

    I'm curious what it means and how to fix it. This occurs in both Chrome and Firefox.

    i've tried creating the following editor script but still see the message, am i missing something about how to set property strings?

    do they have to be called before every BuildPlayer call from an editor script, or is it something i can call once and will be stored in the project settings?

    using UnityEngine;
    using System.Collections;
    using UnityEditor;

    public sealed class WebGLBuildArgs
    {
    [MenuItem("Tools/SetWebGLBuildArgs")]
    public static void SetWebGLBuildArgs()
    {
    PlayerSettings.SetPropertyString("emscriptenArgs", "-s DEMANGLE_SUPPORT=1", BuildTargetGroup.WebGL);
    PlayerSettings.SetPropertyString("emscriptenArgs", "DLOPEN_SUPPORT=1", BuildTargetGroup.WebGL);
    string[] levels = {"Assets/Scenes/LoadScene.unity", "Assets/Scenes/Game.unity"};

    BuildPipeline.BuildPlayer(levels, "adcap-dev", BuildTarget.WebGL, BuildOptions.None);
    }
    }
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I think the error message relates to parameters passed to Emscripten when building the game, and AFAIK Unity invokes the toolchain with its own set of parameters; you cannot really modify that.
     
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Yeah, these errors come from emscripten, and you don't really have access to the emscripten command line to add those options.

    But, more importantly, the error about DLOPEN_SUPPORT seems to indicate that some code is trying to load some dynamic library. That would likely not work anyways, as that library wouldn't be available in WebGL. So the real question is what code causes this error to come up.
     
  4. hyperhippo

    hyperhippo

    Joined:
    Jan 16, 2014
    Posts:
    37
    It's a pretty big project, I think the prime[31] plugin we have for mobile IAP might still be getting included in the build since some scripts have "using prime31;" even though the functions that are being used are wrapped in UNITY_IOS and UNITY_ANDROID checks.

    All our other dll's seem to be marked specifically for the android and ios platforms in their import settings, so i'm not sure what else could be the culprit.
     
  5. alexandru.badescu

    alexandru.badescu

    Joined:
    May 5, 2014
    Posts:
    8
    @
    Have you found the issue? I'm also getting this and i have prime31 stuff integrated.
     
  6. stephen_2ndcity

    stephen_2ndcity

    Joined:
    Sep 2, 2014
    Posts:
    1
    I'm having this problem as well, are we able to check what library/code is causing the issue?
     
  7. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,144
    I had the same error.

    This thread helped me to identify which place in my code caused my webgl build to crash:
    https://forum.unity3d.com/threads/webgl-demangle-support.288624/

    Specifically, you need to execute this line before build to get meaningful debug logs:
    Code (CSharp):
    1. PlayerSettings.SetPropertyString("emscriptenArgs", "-s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1 -s -Werror", BuildTargetGroup.WebGL);
    After adding these compiler options I managed to find the bad code. It was a call to System.Net.NetworkInformation.NetworkInterface which caused a dynamic dll load and caused this error:
    Code (CSharp):
    1. "need to build with DLOPEN_SUPPORT=1 to get dlopen support in asm.js"
     
  8. TheRoccoB

    TheRoccoB

    Joined:
    Jun 29, 2017
    Posts:
    54
    In Unity 2018.3 when I make a development build, I get a callstack w/ relatively readable function names (w/o doing that demangle step).

    I was able to pinpoint this to the inclusion of "WebRequest" from "System.Net". Apparently System.net is a separate DLL that maybe doesn't work w/ WebGL.

    My particular solution will likely be to replace WebRequest w/ UnityEngine.Networking.UnityWebRequest. If you do have a DLL that you MUST include, I'm not sure what to do, but luckily in my case there's a suitable replacement in Unity API's.
     
  9. yeagob

    yeagob

    Joined:
    Jan 27, 2014
    Posts:
    18
    We have the same problem and I had try same soluition, but error persist. Did you resolve it by another way?
     
  10. TheRoccoB

    TheRoccoB

    Joined:
    Jun 29, 2017
    Posts:
    54
    Other than manually removing stuff till it works?

    Nope I haven't figured that out.
     
  11. jean-paul_unity149

    jean-paul_unity149

    Joined:
    Jun 24, 2019
    Posts:
    2
    Has anyone found a solution to this problem? I have not been able to resolve this and am not able to build with the PlayerSettings Code
     
    Twyker_gp likes this.