Unity windows IL2CPP build error GameAssembly.dll failed

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

I have the same problem. also.

Hello, almost the same error is happening to me too with Unity 2021.3.22f1, anyone found what's the cause??

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.

I'm not sure if it's related but I'm also having issues with Win64 IL2CPP when building in batchmode some editor libraries do not get properly resolved in 2021.3.x

https://discussions.unity.com/t/925677

Oh that's a great tip and makes a lot of sense, I'll look into that, thank you!

The same happens with the 2021.3.17 version. I want your help... How did you solve it

The same happens with the 2021.3.8 version IL2CPP. help

Can you provide details about the error message you see?

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!

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.

[quote=“JoshPeterson”, post:11, topic: 919305]
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.
[/quote]

Thanks for you reply, Please read this post https://discussions.unity.com/t/944704 , 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~:)