Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Unable to build IL2CPP in Unity 2021.3.8f1

Discussion in 'Windows' started by yucline, Mar 27, 2023.

  1. yucline

    yucline

    Joined:
    Sep 27, 2017
    Posts:
    6
    Hi there,

    I'm trying to build in IL2CPP but I keep getting errors. In Mono it seems to work fine but I can't fix this IL2CPP error no matter what I try.

    What I have:
    - Unity Hub: IL2CPP module installed
    - VS: Practically everything installed except "Other toolsets",. I also added Windows 11 SDK and the v142 modules.

    The errors I get:

    1.
    Code (CSharp):
    1. Building Library\Bee\artifacts\WinPlayerBuildProgram\ei6vj\ccap_u_vm6.lump.obj failed with output:
    2. 5ihu_vm6.lump.cpp
    3. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(71): error C2039: 'hash_compare': is not a member of 'stdext'
    4. C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\iterator(1447): note: see declaration of 'stdext'
    5. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(71): error C2065: 'hash_compare': undeclared identifier
    6. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(71): error C2275: 'Key': expected an expression instead of a type
    7. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(38): error C2976: 'Il2CppReaderWriterLockedHashMap': too few template arguments
    8. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(75): note: see declaration of 'Il2CppReaderWriterLockedHashMap'
    9. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(38): error C2955: 'Il2CppReaderWriterLockedHashMap': use of class template requires template argument list
    10. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(75): note: see declaration of 'Il2CppReaderWriterLockedHashMap'
    11. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(47): error C2955: 'Il2CppReaderWriterLockedHashMap': use of class template requires template argument list
    12. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(75): note: see declaration of 'Il2CppReaderWriterLockedHashMap'
    13. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(385): error C2662: 'bool Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::TryGet(const Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::key_type &,T *)': cannot convert 'this' pointer from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &'
    14. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(385): note: Reason: cannot convert from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>'
    15. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(385): note: Conversion requires a second user-defined-conversion operator or constructor
    16. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(90): note: see declaration of 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::TryGet'
    17. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(385): note: while trying to match the argument list '(Il2CppClass *, Il2CppClass **)'
    18. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(438): error C2662: 'bool Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::Add(const Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::key_type &,const T &)': cannot convert 'this' pointer from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &'
    19. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(438): note: Reason: cannot convert from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>'
    20. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(438): note: Conversion requires a second user-defined-conversion operator or constructor
    21. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(102): note: see declaration of 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::Add'
    22. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(438): note: while trying to match the argument list '(Il2CppClass *, Il2CppClass *)'
    23. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): error C2955: 'Il2CppReaderWriterLockedHashMap': use of class template requires template argument list
    24. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(75): note: see declaration of 'Il2CppReaderWriterLockedHashMap'
    25. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): error C2662: 'Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::iterator Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedBegin(void)': cannot convert 'this' pointer from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &'
    26. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): note: Reason: cannot convert from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>'
    27. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): note: Conversion requires a second user-defined-conversion operator or constructor
    28. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(121): note: see declaration of 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedBegin'
    29. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): note: while trying to match the argument list '()'
    30. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): error C2662: 'Il2CppHashMap<Key,T,HashFcn,EqualKey,Alloc>::iterator Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedEnd(void)': cannot convert 'this' pointer from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc> &'
    31. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): note: Reason: cannot convert from 'PointerTypeMap' to 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>'
    32. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): note: Conversion requires a second user-defined-conversion operator or constructor
    33. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\utils\Il2CppHashMap.h(127): note: see declaration of 'Il2CppReaderWriterLockedHashMap<Key,T,HashFcn,EqualKey,Alloc>::UnlockedEnd'
    34. C:\Program Files\Unity\Hub\Editor\2021.3.8f1\Editor\Data\il2cpp\libil2cpp\vm\MetadataCache.cpp(1135): note: while trying to match the argument list '()'
    35. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    36.  

    2.
    Code (CSharp):
    1. BuildFailedException: Incremental Player build failed!
    2. UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    3. UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    4. UnityEditor.WindowsStandalone.WinPlayerPostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at C:/buildslave/unity/build/PlatformDependent/WinPlayer/Extensions/Managed/WinPlayerPostProcessor.cs:38)
    5. UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    7.  


    3.
    Code (CSharp):
    1. Build completed with a result of 'Failed' in 63 seconds (62941 ms)
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

    4.
    Code (CSharp):
    1. UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
    2.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <5f40cdb07bd44d76a23dad985a4ec283>:0
    3.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <5f40cdb07bd44d76a23dad985a4ec283>:0
    4. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    5.  


    If anyone can help with this, that would be great. I am really lost as to why this is not working at this point now that pretty much everything is installed.
     
  2. yucline

    yucline

    Joined:
    Sep 27, 2017
    Posts:
    6
    Update:
    After this, In desperation I upgraded to a different Unity version. (2021.3.21f1) and magically it worked.

    Seems the Unity version is the problem.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,172