Search Unity

Bug Unity windows IL2CPP build error GameAssembly.dll failed

Discussion in 'Editor & General Support' started by edunok06_unity, May 31, 2023.

  1. edunok06_unity

    edunok06_unity

    Joined:
    Feb 27, 2020
    Posts:
    12
    Hi all,

    I ran a win stanalone x64 build with IL2CPP and got those error:


    Building Library\Bee\artifacts\WinPlayerBuildProgram\u1oik\GameAssembly.dll failed with output:
    Creation of library Library/Bee/artifacts/WinPlayerBuildProgram/u1oik/GameAssembly.dll.lib and of object Library/Bee/artifacts/WinPlayerBuildProgram/u1oik/GameAssembly.dll.exp
    rluutxashcc0.obj : error LNK2019: external symbol reference dlopen not resolved in function InteropLibraryLoader_Load_mC870612748A6487A3B95C275EAF291F31C150F3B
    rluutxashcc0.obj : error LNK2019: external symbol reference dlsym not resolved in function LinuxInterops_dlsym_mC54414FD6569FEE07DB1E39B39C935ECFD6EE24E
    rluutxashcc0.obj : error LNK2019: external symbol reference dlclose not resolved in function InteropLibraryLoader_Unload_mDE610081A54FFFDE87B8D8FE8472A9E0B57B269C
    Library\Bee\artifacts\WinPlayerBuildProgram\u1oik\GameAssembly.dll : fatal error LNK1120

    Any ideas?
    Thanks in advance
     
  2. KimHyungCheol

    KimHyungCheol

    Joined:
    Dec 16, 2016
    Posts:
    3
    I have the same problem. also.
     
  3. pravusjif

    pravusjif

    Joined:
    Jul 24, 2012
    Posts:
    18
    Hello, almost the same error is happening to me too with Unity 2021.3.22f1, anyone found what's the cause??
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    Generally means you have a script or a precompiled DLL in your project that does "[DllImport("__Internal")]" and doesn't provide the method implementation for Windows. When using IL2CPP, these methods get resolved statically at link time and if they're missing you get such linker error.
     
  5. leon_unity65

    leon_unity65

    Joined:
    May 19, 2023
    Posts:
    5
  6. pravusjif

    pravusjif

    Joined:
    Jul 24, 2012
    Posts:
    18
    Oh that's a great tip and makes a lot of sense, I'll look into that, thank you!
     
  7. fnc176

    fnc176

    Joined:
    Sep 26, 2023
    Posts:
    3
    The same happens with the 2021.3.17 version. I want your help... How did you solve it
     
  8. hmfff

    hmfff

    Joined:
    Dec 19, 2017
    Posts:
    4
    The same happens with the 2021.3.8 version IL2CPP. help
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    Can you provide details about the error message you see?
     
  10. xssxs

    xssxs

    Joined:
    Wednesday
    Posts:
    6
    Hi,I wonder how to statically link a 3rd lib during il2cpp build process?
    for cs code, i know i should use "[DllImport("__Internal")]" ,but for 3rd lib itself, how to let il2cpp know this lib file?
    Thanks!
     
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    On platforms that support dynamic libraries (like Windows desktop), I would recommend you use a dynamic library instead of a static library. See https://docs.unity3d.com/Manual/NativePlugins.html for more details about how to do that with Unity.

    Static libraries can suffer from some subtle problems, as you often need to ensure the C++ compiler and toolchain used to build the static library matches exactly with the one used to build the Unity player. Dynamic libraries offer more flexibility in this regard.
     
  12. xssxs

    xssxs

    Joined:
    Wednesday
    Posts:
    6
    Thanks for you reply, Please read this post https://forum.unity.com/threads/fat...statically-link-in-unity-2022-3-24f1.1580124/ , I have successfully statically link my lib file into GameAssembly.dll in Unity 2020.3 While failed in 2022.3, and I think the problem lies in il2cpp.exe itself.
    Hope to get your help~:)