Search Unity

To use dlopen, you need to use Emscripten's linking support

Discussion in 'Web' started by Homeak16, Mar 15, 2018.

  1. mmmshuddup

    mmmshuddup

    Joined:
    Feb 9, 2015
    Posts:
    4
    In my case, for Unity 2019.4.18f1 (LTS) and having some Oculus stuff installed for running in the editor and testing, I got this error too but slightly different. It was in the ONSPAudioSource.cp file:

    Code (CSharp):
    1. #if !UNITY_WEBGL
    2.     [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    3.     static void OnBeforeSceneLoadRuntimeMethod()
    4.     {
    5.         OSP_SetGlobalVoiceLimit(ONSPSettings.Instance.voiceLimit);
    6.     }
    7. #endif
    8.  
    9. // ...
    10.  
    11. #if !UNITY_WEBGL
    12.     [System.Runtime.InteropServices.DllImport("AudioPluginOculusSpatializer")]
    13.     private static extern int OSP_SetGlobalVoiceLimit(int VoiceLimit);
    14. #endif
    This fixed it. Ironically there are many instances of using System.Threading; and even async tasks in my code but none of those caused that error.
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks @tobiass for the reply. If you have tested the Photon plugin initialization flow to work on WebGL, then it should not spontaneously break on users as long as the plugin goes through the same initialization flow for users that avoids attempting to dlopen(). Conditionally skipping dynamic execution at runtime is enough.

    @HeraticGalaxy @VonTala Can you print out the error callstack from a Development build? That can help pinpoint the offending plugin in question.
     
    tobiass likes this.
  3. l0calhost

    l0calhost

    Joined:
    Jan 11, 2018
    Posts:
    1
    Same error here. Unity 2019.4.23f1 with PUN 2. Simple lobby and room setup.

    Error log here:

    Code (JavaScript):
    1. Connected to the Master Server
    2. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    3.  
    4.  
    5. 6c817bed-72a5-40dc-9c58-a7172932570a:3254 Joined Lobby
    6. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    7.  
    8.  
    9. 6c817bed-72a5-40dc-9c58-a7172932570a:3254 roomList.Count : 0
    10. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    11.  
    12.  
    13. 6c817bed-72a5-40dc-9c58-a7172932570a:3254 Joined the room successfully
    14. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    15.  
    16.  
    17. 6c817bed-72a5-40dc-9c58-a7172932570a:3254 Current Room Name : Test
    18. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    19.  
    20.  
    21. 6c817bed-72a5-40dc-9c58-a7172932570a:3254 UnloadTime: 2.835001 ms
    22.  
    23. 6c817bed-72a5-40dc-9c58-a7172932570a:3254 Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
    24.  
    25. UnityLoader.js:1149 To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking
    26. UnityLoader.js:1150 To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking
    27. printErr @ UnityLoader.js:1150
    28. UnityLoader.js:417 Invoking error handler due to
    29. Uncaught abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at Error
    30.     at jsStackTrace (WebGL.wasm.framework.unityweb:730:12)
    31.     at stackTrace [Object.stackTrace] (WebGL.wasm.framework.unityweb:744:11)
    32.     at Object.onAbort (http://localhost/Build/UnityLoader.js:1145:50)
    33.     at abort (WebGL.wasm.framework.unityweb:28799:20)
    34.     at _dlopen (WebGL.wasm.framework.unityweb:9382:2)
    35.     at __ZN6il2cpp2osL19LoadLibraryWithNameEPKci [il2cpp::os::LoadLibraryWithName(char const*, int)] (<anonymous>:wasm-function[72356]:0x148ba04)
    36.     at __ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryERKNS_5utils10StringViewIcEEi [il2cpp::os::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char> const&, int)] (<anonymous>:wasm-function[72355]:0x148b910)
    37.     at __ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryERKNS_5utils10StringViewIcEE [il2cpp::os::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char> const&)] (<anonymous>:wasm-function[72354]:0x148b86a)
    38.     at __ZN6il2cpp2vm13LibraryLoader18LoadDynamicLibraryENS_5utils10StringViewIcEE [il2cpp::vm::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char>)] (<anonymous>:wasm-function[74192]:0x14ca412)
    39.     at __ZN6il2cpp2vm14PlatformInvoke7ResolveERK16PInvokeArguments [il2cpp::vm::PlatformInvoke::Resolve(PInvokeArguments const&)] (<anonymous>:wasm-function[74292]:0x14ce716)
    40.     at __Z22il2cpp_codegen_resolveRK16PInvokeArguments [il2cpp_codegen_resolve(PInvokeArguments const&)] (<anonymous>:wasm-function[75329]:0x14f25e6)
    41.     at __Z30il2cpp_codegen_resolve_pinvokeIPFilELm17ELm26EET_RAT0__KcRAT1__S3_20Il2CppCallConvention13Il2CppCharSetib [int (*il2cpp_codegen_resolve_pinvoke<int (*)(long), 17ul, 26ul>(char const (&) [17ul], char const (&) [26ul], Il2CppCallConvention, Il2CppCharSet, int, bool))(long)] (<anonymous>:wasm-function[47603]:0xf79eae)
    42.     at _IRtcEngineNative_initEventOnEngineCallback_m3A4F71E554445FCE0E295FABC9546CA0CB65B1E4 (<anonymous>:wasm-function[47803]:0xf84068)
    43.     at _IRtcEngine_InitEngineCallback_mD49885C6628BF6F49629FBBCEF91D32A929C9A8C (<anonymous>:wasm-function[47798]:0xf83f62)
    44.     at _IRtcEngine__ctor_m1BA892F0E177EC7E66557C1D2DC206052D183D36 (<anonymous>:wasm-function[47796]:0xf83421)
    45.     at _IRtcEngine_GetEngine_mE410215AF9D5B134F586D9933E22F8C2DD2931F6 (<anonymous>:wasm-function[48099]:0xf89752)
    46.     at _HelloUnity3D_Start_m58445B16C3D16B5F874BC6CF6E930A959A9B9726 (<anonymous>:wasm-function[34453]:0xd3c214)
    47.     at __Z65RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017PFvvEPK10MethodInfoPvPS4_ [RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017(void (*)(), MethodInfo const*, void*, void**)] (<anonymous>:wasm-function[32083]:0xcfe915)
    48.     at dynCall_iiiii (<anonymous>:wasm-function[75947]:0x1520108)
    49.     at dynCall_iiiii [Object.dynCall_iiiii] (WebGL.wasm.framework.unityweb:27247:40)
    50.     at invoke_iiiii (WebGL.wasm.framework.unityweb:17545:33)
    51.     at __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException [il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)] (<anonymous>:wasm-function[73235]:0x14ab3dc)
    52.     at _il2cpp_runtime_invoke (<anonymous>:wasm-function[72192]:0x1487d05)
    53.     at __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb [scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)] (<anonymous>:wasm-function[6198]:0x2483b8)
    54.     at __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb [ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)] (<anonymous>:wasm-function[6195]:0x247f1a)
    55.     at __ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr [MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingExceptionPtr*)] (<anonymous>:wasm-function[10494]:0x3a0a85)
    56.     at __ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr [MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr)] (<anonymous>:wasm-function[10490]:0x39f927)
    57.     at __ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv [MonoBehaviour::DelayedStartCall(Object*, void*)] (<anonymous>:wasm-function[13174]:0x4b4303)
    58.     at __ZN18DelayedCallManager6UpdateEi [DelayedCallManager::Update(int)] (<anonymous>:wasm-function[10844]:0x3c7408)
    59.     at __ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv [InitPlayerLoopCallbacks()::EarlyUpdateScriptRunDelayedStartupFrameRegistrator::Forward()] (<anonymous>:wasm-function[13812]:0x4f960e)
    60.     at __Z17ExecutePlayerLoopP22NativePlayerLoopSystem [ExecutePlayerLoop(NativePlayerLoopSystem*)] (<anonymous>:wasm-function[13300]:0x4bef44)
    61.     at __Z17ExecutePlayerLoopP22NativePlayerLoopSystem [ExecutePlayerLoop(NativePlayerLoopSystem*)] (<anonymous>:wasm-function[13300]:0x4bef59)
    62.     at __Z10PlayerLoopv [PlayerLoop()] (<anonymous>:wasm-function[13285]:0x4bdf84)
    63.     at __ZL8MainLoopv [MainLoop()] (<anonymous>:wasm-function[13273]:0x4bbdc1)
    64.     at dynCall_v (<anonymous>:wasm-function[76041]:0x1520cc5)
    65.     at dynCall_v [Object.dynCall_v] (WebGL.wasm.framework.unityweb:27717:36)
    66.     at browserIterationFunc (WebGL.wasm.framework.unityweb:9539:23)
    67.     at runIter [Object.runIter] (WebGL.wasm.framework.unityweb:9641:5)
    68.     at Browser_mainLoop_runner (WebGL.wasm.framework.unityweb:9577:20)
    69. 6c817bed-72a5-40dc-9c58-a7172932570a:9647 Uncaught abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at Error
    70.     at jsStackTrace (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:730:12)
    71.     at Object.stackTrace (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:744:11)
    72.     at Object.onAbort (http://localhost/Build/UnityLoader.js:1145:50)
    73.     at abort (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:28799:20)
    74.     at _dlopen (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:9382:2)
    75.     at __ZN6il2cpp2osL19LoadLibraryWithNameEPKci [il2cpp::os::LoadLibraryWithName(char const*, int)] (<anonymous>:wasm-function[72356]:0x148ba04)
    76.     at __ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryERKNS_5utils10StringViewIcEEi [il2cpp::os::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char> const&, int)] (<anonymous>:wasm-function[72355]:0x148b910)
    77.     at __ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryERKNS_5utils10StringViewIcEE [il2cpp::os::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char> const&)] (<anonymous>:wasm-function[72354]:0x148b86a)
    78.     at __ZN6il2cpp2vm13LibraryLoader18LoadDynamicLibraryENS_5utils10StringViewIcEE [il2cpp::vm::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char>)] (<anonymous>:wasm-function[74192]:0x14ca412)
    79.     at __ZN6il2cpp2vm14PlatformInvoke7ResolveERK16PInvokeArguments [il2cpp::vm::PlatformInvoke::Resolve(PInvokeArguments const&)] (<anonymous>:wasm-function[74292]:0x14ce716)
    80.     at __Z22il2cpp_codegen_resolveRK16PInvokeArguments [il2cpp_codegen_resolve(PInvokeArguments const&)] (<anonymous>:wasm-function[75329]:0x14f25e6)
    81.     at __Z30il2cpp_codegen_resolve_pinvokeIPFilELm17ELm26EET_RAT0__KcRAT1__S3_20Il2CppCallConvention13Il2CppCharSetib [int (*il2cpp_codegen_resolve_pinvoke<int (*)(long), 17ul, 26ul>(char const (&) [17ul], char const (&) [26ul], Il2CppCallConvention, Il2CppCharSet, int, bool))(long)] (<anonymous>:wasm-function[47603]:0xf79eae)
    82.     at _IRtcEngineNative_initEventOnEngineCallback_m3A4F71E554445FCE0E295FABC9546CA0CB65B1E4 (<anonymous>:wasm-function[47803]:0xf84068)
    83.     at _IRtcEngine_InitEngineCallback_mD49885C6628BF6F49629FBBCEF91D32A929C9A8C (<anonymous>:wasm-function[47798]:0xf83f62)
    84.     at _IRtcEngine__ctor_m1BA892F0E177EC7E66557C1D2DC206052D183D36 (<anonymous>:wasm-function[47796]:0xf83421)
    85.     at _IRtcEngine_GetEngine_mE410215AF9D5B134F586D9933E22F8C2DD2931F6 (<anonymous>:wasm-function[48099]:0xf89752)
    86.     at _HelloUnity3D_Start_m58445B16C3D16B5F874BC6CF6E930A959A9B9726 (<anonymous>:wasm-function[34453]:0xd3c214)
    87.     at __Z65RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017PFvvEPK10MethodInfoPvPS4_ [RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017(void (*)(), MethodInfo const*, void*, void**)] (<anonymous>:wasm-function[32083]:0xcfe915)
    88.     at dynCall_iiiii (<anonymous>:wasm-function[75947]:0x1520108)
    89.     at Object.dynCall_iiiii (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:27247:40)
    90.     at invoke_iiiii (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:17545:33)
    91.     at __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException [il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)] (<anonymous>:wasm-function[73235]:0x14ab3dc)
    92.     at _il2cpp_runtime_invoke (<anonymous>:wasm-function[72192]:0x1487d05)
    93.     at __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb [scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)] (<anonymous>:wasm-function[6198]:0x2483b8)
    94.     at __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb [ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)] (<anonymous>:wasm-function[6195]:0x247f1a)
    95.     at __ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr [MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingExceptionPtr*)] (<anonymous>:wasm-function[10494]:0x3a0a85)
    96.     at __ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr [MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr)] (<anonymous>:wasm-function[10490]:0x39f927)
    97.     at __ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv [MonoBehaviour::DelayedStartCall(Object*, void*)] (<anonymous>:wasm-function[13174]:0x4b4303)
    98.     at __ZN18DelayedCallManager6UpdateEi [DelayedCallManager::Update(int)] (<anonymous>:wasm-function[10844]:0x3c7408)
    99.     at __ZZ23InitPlayerLoopCallbacksvEN50EarlyUpdateScriptRunDelayedStartupFrameRegistrator7ForwardEv [InitPlayerLoopCallbacks()::EarlyUpdateScriptRunDelayedStartupFrameRegistrator::Forward()] (<anonymous>:wasm-function[13812]:0x4f960e)
    100.     at __Z17ExecutePlayerLoopP22NativePlayerLoopSystem [ExecutePlayerLoop(NativePlayerLoopSystem*)] (<anonymous>:wasm-function[13300]:0x4bef44)
    101.     at __Z17ExecutePlayerLoopP22NativePlayerLoopSystem [ExecutePlayerLoop(NativePlayerLoopSystem*)] (<anonymous>:wasm-function[13300]:0x4bef59)
    102.     at __Z10PlayerLoopv [PlayerLoop()] (<anonymous>:wasm-function[13285]:0x4bdf84)
    103.     at __ZL8MainLoopv [MainLoop()] (<anonymous>:wasm-function[13273]:0x4bbdc1)
    104.     at dynCall_v (<anonymous>:wasm-function[76041]:0x1520cc5)
    105.     at Object.dynCall_v (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:27717:36)
    106.     at browserIterationFunc (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:9539:23)
    107.     at Object.runIter (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:9641:5)
    108.     at Browser_mainLoop_runner (blob:http://localhost/6c817bed-72a5-40dc-9c58-a7172932570a:9577:20)
    109. 6c817bed-72a5-40dc-9c58-a7172932570a:6187 warning: 2 FS.syncfs operations in flight at once, probably just doing extra work
    110. 276c817bed-72a5-40dc-9c58-a7172932570a:3247 An abnormal situation has occurred: the PlayerLoop internal function has been called recursively. Please contact Customer Support with a sample project so that we can reproduce the problem and troubleshoot it.
    111. (Filename: ./Runtime/Misc/PlayerLoop.cpp Line: 397)
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    @l0calhost, do you use any other libraries or packages in the project?
    I don't really think this should be related to PUN 2 but ... which version do you use?
     
  5. BigSteph71

    BigSteph71

    Joined:
    Apr 6, 2021
    Posts:
    4
    Then please modify your WebAssembly build scripts to statically link the DLLs!

    That error is coming from the emscripten tell you (Unity) that you are not using the build flags correctly

    All C++ compilers support static linking options. Unfortunately I am not familiar enough to understand where your compiler options are used to figure out how to add the static linking flags. If you are not willing to do this maybe send us to a place where we can customize the WebGL build process?
     
  6. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thank you, the sentiment is appreciated, but that is not what is happening here. I am well aware of the Emscripten message, since I believe I am the person who authored that message into the Emscripten toolchain in 2014 or so.

    We do compile all DLLs (C# IL assemblies) that are part of the Unity project over to static libraries using IL2CPP. This code is then statically linked with the rest of the Unity project, and the Unity engine, to produce the final .wasm build.

    However not all DLLs are C# IL assemblies. Some DLLs are native libraries containing e.g. x86 or ARM code, which are supported by Unity on native platforms. Such DLLs cannot be converted by IL2CPP, as it is already native assembly code.

    What is happening here is that any unlinked functions that remain at runtime, will trigger the Microsoft .NET PInvoke lookup mechanism to dynamically attempt to load in a DLL that would have the necessary code. However this has a few problems:
    1. On the web such a DLL, even if it existed, and was C# IL, would not be possible to be loaded in to .wasm, since it would need to first to be run through the IL2CPP toolchain,
    2. The DLL could also be a x86 or ARM native plugin, which plugin authors commonly do e.g. to access native sockets or some other native feature of the operating system. Those do not have an alternative on the web,
    3. Even if the plugin author did develop a C# IL only containing plugin, that was taken through IL2CPP, to build a wasm dynamic library (which is kind of silly, since when doing all that, one could already statically link anyways), the dynamic library binding comes at a considerable performance cost due to how wasm dynamic linking dispatch works. Simply having a static library in the first place avoids that issue.

    The real issue here is that the error message that is being printed was awkward, since the IL2CPP build system accidentally called out to popen() to trigger this path in Emscripten. That was never intentional. In Unity 2021.1 (I think it first appeared) the error message has been better worded to not give out a red herring.

    My understanding is that PUN 2 uses a native x86 DLL plugin to implement TCP & UDP Sockets access for the networking library (or imports System.Net or similar that would attempt to do the same). That library is not usable for the web, and for that reason, PUN 2 provides a specific WebGL support backend that relies on WebSosckets and avoids the use of native x86 compiled DLLs. PUN authors should be able to help on that detail more, maybe with code samples on how the library is expected to be used.

    It is naturally possible that there is a Unity engine regression/bug or a PUN 2 regression/bug that is at play here. But in order to conclude such, we should really be looking at test cases that you, we and PUN2 authors expect to work and don't. Maybe that will uncover a code construct that should not be there to use PUN2 on WebGL, or maybe that will uncover a regression or a bug that nobody knew about before, or another path forward.
     
    MNNoxMortem likes this.
  7. BigSteph71

    BigSteph71

    Joined:
    Apr 6, 2021
    Posts:
    4
    Ok I see what happened in my case - it was the HTTP fetch. We were not using the HTTP fetch as per Unity documentation but another HTTP client library. Maybe I don't understand enough the details here, but would it not be possible to detect any dlopen callouts from third party DLLs up front, and more importantly to identify the actual function that triggered the dl_open call? In our case we got more information by commenting out that dl_open error message, so adding this message was not really of much help. One of the DLLs was trying to load libc.dll - but no info on the actual DLL doing the loading or the function which caused the load to happen.
     
    Last edited: May 4, 2021
  8. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
  9. rlalancette

    rlalancette

    Joined:
    Sep 20, 2014
    Posts:
    18
    Still an issue with 2020.3.19f1

    upload_2021-10-4_13-38-51.png
     

    Attached Files:

  10. Uwen

    Uwen

    Joined:
    Jul 10, 2019
    Posts:
    1
    public void GetHeroBalance()
    {
    Debug.Log("开始获取合约余额");
    //StartCoroutine(GetHeroBalanceRun((o) => {
    // Debug.Log("从合约中获取的余额为:" + o.ReturnValue1);
    //}));

    var task = GetHeroBalanceRun();
    }
    private async Task GetHeroBalanceRun()
    {
    Debug.Log("开始建立Web3");
    Web3 web3 = new Web3(NethereumController.RPC_URL);
    Debug.Log("获取合约");
    var contract = web3.Eth.GetContract(XgameDeploymentBase.ABI, XgameDeploymentBase.BYTECODE);
    Debug.Log("获取函数");
    var func = contract.GetFunction<BalanceOfFunction>();
    Debug.Log("运行函数");
    BigInteger balance = await func.CallAsync<BigInteger>(new BalanceOfFunction() { Owner = DataController.GetAddress() });
    Console.WriteLine("获取到英雄数量:" + balance);
    }


    I need to use nethereum .net to develop a dApp. but it throws an exception when the log stop between Debug.Log and Console.WriteLine. The exception message is "To use dlopen, you need to use Emscripten's linking support...". So is there has any way to make it works? Or maybe someone can tell me why exception by this code.
     
  11. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    95
    Can you point what in that log that you indicated shows where the call is originating from? I am getting the same error and trying to track what library is causing this
     
  12. jasonboukheir

    jasonboukheir

    Joined:
    May 3, 2017
    Posts:
    84
    Hi, @jukka_j I'm running WebGL Player Tests in Unity 2020.3, and trying to track down a similar error. Below is my stack trace. What is the useful bit? I'm having trouble tracking this down, and it looks like some other folks had trouble reading the logs as well.

    Code (CSharp):
    1. [Log] Invoking error handler due to (PlayerWithTests.loader.js, line 279)
    2. abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at jsStackTrace@http://localhost:56020/Build/PlayerWithTests.framework.js:1910:21
    3. stackTrace@http://localhost:56020/Build/PlayerWithTests.framework.js:1924:23
    4. abort@http://localhost:56020/Build/PlayerWithTests.framework.js:1179:54
    5. _dlopen@http://localhost:56020/Build/PlayerWithTests.framework.js:10272:7
    6. wasm-stub@[wasm code]
    7. <?>.wasm-function[__ZN6il2cpp2osL19LoadLibraryWithNameEPKci [il2cpp::os::LoadLibraryWithName(char const*, int)]]@[wasm code]
    8. <?>.wasm-function[__ZN6il2cpp2os13LibraryLoader22LoadDynamicLibraryImplERKNS_5utils10StringViewIcEEi [il2cpp::os::LibraryLoader::LoadDynamicLibraryImpl(il2cpp::utils::StringView<char> const&, int)]]@[wasm code]
    9. <?>.wasm-function[__ZN6il2cpp2os13LibraryLoader22LoadDynamicLibraryImplERKNS_5utils10StringViewIcEE [il2cpp::os::LibraryLoader::LoadDynamicLibraryImpl(il2cpp::utils::StringView<char> const&)]]@[wasm code]
    10. <?>.wasm-function[__ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryENS_5utils10StringViewIcEEi [il2cpp::os::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char>, int)]]@[wasm code]
    11. <?>.wasm-function[__ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryENS_5utils10StringViewIcEE [il2cpp::os::LibraryLoader::LoadDynamicLibrary(il2cpp::utils::StringView<char>)]]@[wasm code]
    12. <?>.wasm-function[__ZN6il2cpp2vm14PlatformInvoke7ResolveERK16PInvokeArguments [il2cpp::vm::PlatformInvoke::Resolve(PInvokeArguments const&)]]@[wasm code]
    13. <?>.wasm-function[__Z22il2cpp_codegen_resolveRK16PInvokeArguments [il2cpp_codegen_resolve(PInvokeArguments const&)]]@[wasm code]
    14. <?>.wasm-function[__Z30il2cpp_codegen_resolve_pinvokeIPFilELm5ELm6EET_RAT0__KcRAT1__S3_20Il2CppCallConvention13Il2CppCharSetib [int (*il2cpp_codegen_resolve_pinvoke<int (*)(long), 5ul, 6ul>(char const (&) [5ul], char const (&) [6ul], Il2CppCallConvention, Il2CppCharSet, int, bool))(long)]]@[wasm code]
    15. <?>.wasm-function[_OSPlatform_uname_m4F1D8A5592871215F1FEF6F7A2BB4647D999CA36]@[wasm code]
    16. <?>.wasm-function[_OSPlatform_CheckIfIsMacOSX_m6B26B2590007A9B1410E32652566A7435788830A]@[wasm code]
    17. <?>.wasm-function[_U3CU3Ec_U3C_cctorU3Eb__92_0_mFA898E05883ED5DD2F37BACF6CBECD8F73D1FC5C]@[wasm code]
    18. <?>.wasm-function[_ActualValueDelegate_1_Invoke_m3750CB4DA7DBE24C1A4DBEA3205B1906EDE9B8D1_gshared]@[wasm code]
    19. <?>.wasm-function[dynCall_iii]@[wasm code]
    20. wasm-stub@[native code]
    21. @http://localhost:56020/Build/PlayerWithTests.framework.js:26955:43
    22. invoke_iii@http://localhost:56020/Build/PlayerWithTests.framework.js:17617:31
    23. <?>.wasm-function[dynCall_iii]@[wasm code]
    24. <?>.wasm-function[_Lazy_1_InitValue_m4A85130B4D798204D160ACEA6EECF12BDAE5CBF7_gshared]@[wasm code]
    25. <?>.wasm-function[_Lazy_1_get_Value_m91C2789ABCAC85AD95F89A7E9DE0577F886C7C20_gshared]@[wasm code]
    26. <?>.wasm-function[__Z58Lazy_1_get_Value_mE1745A916E26B63B52FA68B23B67A239FA2834B2P48Lazy_1_tDB5E93E0B4FF5D3F20A2607C2AB4C75DC1B6DE31PK10MethodInfo [Lazy_1_get_Value_mE1745A916E26B63B52FA68B23B67A239FA2834B2(Lazy_1_tDB5E93E0B4FF5D3F20A2607C2AB4C75DC1B6DE31*, MethodInfo const*)]]@[wasm code]
    27. <?>.wasm-function[_OSPlatform_get_CurrentPlatform_m81E5DA2146C598A14756C5B8F689CA4CE32631A4]@[wasm code]
    28. <?>.wasm-function[_PlatformHelper__ctor_m2087D5202335C9E0EE156D06BA652933AC2B7EA1]@[wasm code]
    29. <?>.wasm-function[_U3CBuildFromU3Ed__63_MoveNext_mEF95FEC6B3A859EB0D9C06A599BFA1AC6CD954C0]@[wasm code]
    30. <?>.wasm-function[__ZN21InterfaceFuncInvoker0IP48Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6E6InvokeEtP11Il2CppClassP12Il2CppObject [InterfaceFuncInvoker0<Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6*>::Invoke(unsigned short, Il2CppClass*, Il2CppObject*)]]@[wasm code]
    31. <?>.wasm-function[dynCall_iiii]@[wasm code]
    32. wasm-stub@[native code]
    33. @http://localhost:56020/Build/PlayerWithTests.framework.js:26990:44
    34. invoke_iiii@http://localhost:56020/Build/PlayerWithTests.framework.js:17687:32
    35. <?>.wasm-function[dynCall_iiii]@[wasm code]
    36. <?>.wasm-function[_DefaultTestCaseBuilder_BuildFrom_m9DFC0D8EB8C5EF49CDB947BA392EB800C267C0A3]@[wasm code]
    37. <?>.wasm-function[__ZN21InterfaceFuncInvoker2IbPP12Il2CppObjectP47Token_t2FAA2522F5BF6CF2EF2B5F796B8AA837B28E07F4E6InvokeEtP11Il2CppClassS1_S2_S4_ [InterfaceFuncInvoker2<bool, Il2CppObject**, Token_t2FAA2522F5BF6CF2EF2B5F796B8AA837B28E07F4*>::Invoke(unsigned short, Il2CppClass*, Il2CppObject*, Il2CppObject**, Token_t2FAA2522F5BF6CF2EF2B5F796B8AA837B28E07F4*)]]@[wasm code]
    38. <?>.wasm-function[_NUnitTestFixtureBuilder_BuildTestCase_m625FEF3F88B5D4789375EA1B27CD5D8FF4E1F6BC]@[wasm code]
    39. <?>.wasm-function[_NUnitTestFixtureBuilder_AddTestCasesToFixture_m3797D7F970101C75021B55D3CB5ADA903EA8C993]@[wasm code]
    40. <?>.wasm-function[_NUnitTestFixtureBuilder_BuildFrom_m1710D6C746CF628E3BD652FCFD4614D5B5E830CE]@[wasm code]
    41. <?>.wasm-function[dynCall_iiii]@[wasm code]
    42. wasm-stub@[native code]
    43. @http://localhost:56020/Build/PlayerWithTests.framework.js:26990:44
    44. invoke_iiii@http://localhost:56020/Build/PlayerWithTests.framework.js:17687:32
    45. <?>.wasm-function[dynCall_iiii]@[wasm code]
    46. <?>.wasm-function[_DefaultSuiteBuilder_BuildFrom_m25546B62E173594C8F68F8712FF194ADD53D3CFE]@[wasm code]
    47. <?>.wasm-function[__ZN21InterfaceFuncInvoker1IisE6InvokeEtP11Il2CppClassP12Il2CppObjects [InterfaceFuncInvoker1<int, short>::Invoke(unsigned short, Il2CppClass*, Il2CppObject*, short)]]@[wasm code]
    48. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    49. wasm-stub@[native code]
    50. @http://localhost:56020/Build/PlayerWithTests.framework.js:27005:45
    51. invoke_iiiii@http://localhost:56020/Build/PlayerWithTests.framework.js:17717:33
    52. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    53. <?>.wasm-function[_DefaultTestAssemblyBuilder_GetFixtures_m04CEF6D5D366A9E09D72FEB5E01F9D8A6D19E97F]@[wasm code]
    54. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    55. wasm-stub@[native code]
    56. @http://localhost:56020/Build/PlayerWithTests.framework.js:27005:45
    57. invoke_iiiii@http://localhost:56020/Build/PlayerWithTests.framework.js:17717:33
    58. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    59. <?>.wasm-function[_DefaultTestAssemblyBuilder_Build_mEE5B2A25E89E3F15C0C3CC65B90604168F3D7CEB]@[wasm code]
    60. <?>.wasm-function[_DefaultTestAssemblyBuilder_Build_m19A858C054AA4FB10B6BF0DD56AAFAA1BFDD88C5]@[wasm code]
    61. <?>.wasm-function[_U3CBuildAsyncU3Ed__3_MoveNext_mFC852CFCEB0DE354E57B22F1C4F93806644D515F]@[wasm code]
    62. <?>.wasm-function[__ZN21InterfaceFuncInvoker0IP48Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6E6InvokeEtP11Il2CppClassP12Il2CppObject [InterfaceFuncInvoker0<Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6*>::Invoke(unsigned short, Il2CppClass*, Il2CppObject*)]]@[wasm code]
    63. <?>.wasm-function[_UnityTestAssemblyBuilder_Build_m8E11635782F7B80299671C270740D63EB2CE3F83]@[wasm code]
    64. <?>.wasm-function[_UnityTestAssemblyRunner_Load_mA2C933C2F2123F2845737D47BF2CE3ED6925C3D8]@[wasm code]
    65. <?>.wasm-function[_U3CRunU3Ed__16_MoveNext_m93B52E69F355521D01E4A88B025670C91E90369D]@[wasm code]
    66. <?>.wasm-function[__ZN21InterfaceFuncInvoker0IP48Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6E6InvokeEtP11Il2CppClassP12Il2CppObject [InterfaceFuncInvoker0<Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6*>::Invoke(unsigned short, Il2CppClass*, Il2CppObject*)]]@[wasm code]
    67. <?>.wasm-function[_SetupCoroutine_InvokeMoveNext_m036E6EE8C2A4D2DAA957D5702F1A3CA51313F2C7]@[wasm code]
    68. <?>.wasm-function[__Z164RuntimeInvoker_FalseVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5_VoidU2A_tC7FFEB695C165BD92A8656A0260E9CBC93892D9A_Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046PFvvEPK10MethodInfoPvPS4_ [RuntimeInvoker_FalseVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5_VoidU2A_tC7FFEB695C165BD92A8656A0260E9CBC93892D9A_Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046(void (*)(), MethodInfo const*, void*, void**)]]@[wasm code]
    69. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    70. wasm-stub@[native code]
    71. @http://localhost:56020/Build/PlayerWithTests.framework.js:27005:45
    72. invoke_iiiii@http://localhost:56020/Build/PlayerWithTests.framework.js:17717:33
    73. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    74. <?>.wasm-function[__ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException [il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)]]@[wasm code]
    75. <?>.wasm-function[_il2cpp_runtime_invoke]@[wasm code]
    76. <?>.wasm-function[__Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb [scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)]]@[wasm code]
    77. <?>.wasm-function[__ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb [ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)]]@[wasm code]
    78. <?>.wasm-function[__ZN9Coroutine14InvokeMoveNextEP21ScriptingExceptionPtr [Coroutine::InvokeMoveNext(ScriptingExceptionPtr*)]]@[wasm code]
    79. <?>.wasm-function[__ZN9Coroutine3RunEPb [Coroutine::Run(bool*)]]@[wasm code]
    80. <?>.wasm-function[__ZN13MonoBehaviour24TryCreateAndRunCoroutineE18ScriptingObjectPtr18ScriptingMethodPtrPP9Coroutine [MonoBehaviour::TryCreateAndRunCoroutine(ScriptingObjectPtr, ScriptingMethodPtr, Coroutine**)]]@[wasm code]
    81. <?>.wasm-function[__ZN13MonoBehaviour22StartCoroutineManaged2E18ScriptingObjectPtr [MonoBehaviour::StartCoroutineManaged2(ScriptingObjectPtr)]]@[wasm code]
    82. <?>.wasm-function[__Z43MonoBehaviour_CUSTOM_StartCoroutineManaged2P12Il2CppObjectS0_ [MonoBehaviour_CUSTOM_StartCoroutineManaged2(Il2CppObject*, Il2CppObject*)]]@[wasm code]
    83. <?>.wasm-function[_MonoBehaviour_StartCoroutineManaged2_m46EFC2DA4428D3CC64BA3F1394D24351E316577D]@[wasm code]
    84. <?>.wasm-function[_MonoBehaviour_StartCoroutine_m3E33706D38B23CDD179E99BAD61E32303E9CC719]@[wasm code]
    85. <?>.wasm-function[_U3CStartU3Ed__12_MoveNext_mFF0A37E90087AFDC453F59CF238F25DB39CB3E39]@[wasm code]
    86. <?>.wasm-function[__ZN21InterfaceFuncInvoker0IP48Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6E6InvokeEtP11Il2CppClassP12Il2CppObject [InterfaceFuncInvoker0<Action_tAF41423D285AE0862865348CF6CE51CD085ABBA6*>::Invoke(unsigned short, Il2CppClass*, Il2CppObject*)]]@[wasm code]
    87. <?>.wasm-function[_SetupCoroutine_InvokeMoveNext_m036E6EE8C2A4D2DAA957D5702F1A3CA51313F2C7]@[wasm code]
    88. <?>.wasm-function[__Z164RuntimeInvoker_FalseVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5_VoidU2A_tC7FFEB695C165BD92A8656A0260E9CBC93892D9A_Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046PFvvEPK10MethodInfoPvPS4_ [RuntimeInvoker_FalseVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5_VoidU2A_tC7FFEB695C165BD92A8656A0260E9CBC93892D9A_Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046(void (*)(), MethodInfo const*, void*, void**)]]@[wasm code]
    89. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    90. wasm-stub@[native code]
    91. @http://localhost:56020/Build/PlayerWithTests.framework.js:27005:45
    92. invoke_iiiii@http://localhost:56020/Build/PlayerWithTests.framework.js:17717:33
    93. <?>.wasm-function[dynCall_iiiii]@[wasm code]
    94. <?>.wasm-function[__ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException [il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)]]@[wasm code]
    95. <?>.wasm-function[_il2cpp_runtime_invoke]@[wasm code]
    96. <?>.wasm-function[__Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb [scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)]]@[wasm code]
    97. <?>.wasm-function[__ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb [ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)]]@[wasm code]
    98. <?>.wasm-function[__ZN9Coroutine14InvokeMoveNextEP21ScriptingExceptionPtr [Coroutine::InvokeMoveNext(ScriptingExceptionPtr*)]]@[wasm code]
    99. <?>.wasm-function[__ZN9Coroutine3RunEPb [Coroutine::Run(bool*)]]@[wasm code]
    100. <?>.wasm-function[__ZN9Coroutine17ContinueCoroutineEP6ObjectPv [Coroutine::ContinueCoroutine(Object*, void*)]]@[wasm code]
    101. <?>.wasm-function[__ZN18DelayedCallManager6UpdateEi [DelayedCallManager::Update(int)]]@[wasm code]
     
  13. jasonboukheir

    jasonboukheir

    Joined:
    May 3, 2017
    Posts:
    84
    For anyone who may stumble on this, I tracked down the issue by selectively removing tests in my project (figuring that IL2CPP would strip the offending code). I did this by excluding test assemblies in WebGL builds, then rebuilding my player tests. Not the fastest process, but I could tell what assemblies were causing the error and narrow down my search.

    I found that by excluding tests that have
    NUnit.Framework.TestCaseAttribute
    s, the error went away in my player test builds. Removing that attribute from my test code fixed everything. For reference, this is in Unity 2020.3.36f1.