[SOLVED] IL2CPP build failed (2021.2.6)

2021.2.6

Build completed with a result of 'Failed'

[spoiler]

Building Library\Bee\artifacts\Stevedore\win10sdk_432e.StevedoreVersion failed with output:
Downloading: http://stevedore.hq.unity3d.com/r/unity-internal/win10sdk/10.0.19041.0_432eda87d99f6529b15f0d635af568b0301f04d5b34153d67dccb8389a18f578.7z (/A).
stevedore: 15.12.2021 8:36:33 - Failed to download (network error): http://stevedore.hq.unity3d.com/r/unity-internal/win10sdk/10.0.19041.0_432eda87d99f6529b15f0d635af568b0301f04d5b34153d67dccb8389a18f578.7z
���������� ࠧ���� 㤠������ ���: 'stevedore.hq.unity3d.com'
This server is for Unity employees only. Are you on the Unity network/VPN?
HttpRequestException: �ந��諠 �訡�� �� ��ࠢ�� �����.
WebException: ���������� ࠧ���� 㤠������ ���: 'stevedore.hq.unity3d.com'
(Telemetry reference: /A)
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

[/spoiler]

... Looks strange

This does look odd - I don’t think anything should be downloaded during an IL2CPP build. Can you provide more context from the Unity editor log file? I’d like to understand what action triggered this.

Building Library\Bee\artifacts\Stevedore\win10sdk_432e.StevedoreVersion failed with output:
Downloading: http://stevedore.hq.unity3d.com/r/unity-internal/win10sdk/10.0.19041.0_432eda87d99f6529b15f0d635af568b0301f04d5b34153d67dccb8389a18f578.7z (/A).
stevedore: 15.12.2021 17:41:47 - Failed to download (network error): http://stevedore.hq.unity3d.com/r/unity-internal/win10sdk/10.0.19041.0_432eda87d99f6529b15f0d635af568b0301f04d5b34153d67dccb8389a18f578.7z
���������� ࠧ���� 㤠������ ���: ‘stevedore.hq.unity3d.com
This server is for Unity employees only. Are you on the Unity network/VPN?
HttpRequestException: �ந��諠 �訡�� �� ��ࠢ�� �����.
WebException: ���������� ࠧ���� 㤠������ ���: ‘stevedore.hq.unity3d.com
(Telemetry reference: /A)
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <52409df47eec4ff4a3e5a5be37682d54>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <52409df47eec4ff4a3e5a5be37682d54>:0)
UnityEditor.WindowsStandalone.WinPlayerPostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at C:/buildslave/unity/build/PlatformDependent/WinPlayer/Extensions/Managed/WinPlayerPostProcessor.cs:33)
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 <52409df47eec4ff4a3e5a5be37682d54>:0)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

Build completed with a result of ‘Failed’ in 97 seconds (96720 ms)
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

UnityEditor.BuildPlayerWindow+BuildMethodException: 49 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002d8] in <52409df47eec4ff4a3e5a5be37682d54>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <52409df47eec4ff4a3e5a5be37682d54>:0
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

Errors come out at the very last stage, when you are waiting for success.
The assembly already copied, but on startup:

---------------------------
Fatal error
---------------------------
Failed to load il2cpp
---------------------------
OK
---------------------------

Thanks for the additional details! This is actually a bug that we discovered internally. The fix is on the way to Unity releases for 2021.2 and later now.

In the meantime, you can work around this issue by installing the Windows 10 SDK locally. The problem here happens when that SDK is not installed - the code is incorrectly trying to download it from an internal Unity server. Instead, you should see a better error message indicating that the SDK must be installed.

Solved!

Ok so how would I install that locally

I believe that his has been corrected - maybe try the latest Unity release if you have not done so yet.

Same is now happening in Unity 2022.3.9f1. Is this a new issue again?

Many thanks

Yes, it might be a different issue or cause now. Can you submit a bug report to us?

https://unity.com/releases/editor/qa/bug-reporting

Same happens in Unity 2022.3.10f1 !

So to clarify what’s going on, the build does succeed (no particular warning or error in the build log).
When i try to lunch the executable, i get a windows error message box:

Fatal error
“Failed to load il2cpp”

And here is what i get in Player.log

Could not load symbol il2cpp_class_is_inited : The specified procedure could not be found.

il2cpp: function il2cpp_class_is_inited not found
Could not load symbol il2cpp_type_get_reflection_name : The specified procedure could not be found.

il2cpp: function il2cpp_type_get_reflection_name not found
Could not load symbol il2cpp_custom_attrs_from_field : The specified procedure could not be found.

il2cpp: function il2cpp_custom_attrs_from_field not found

Ok, after few digging, now i'm getting this error during compilation:

Building Library\Bee\artifacts\WinPlayerBuildProgram\3wbgm\jhruzj78hal3.obj failed with output:
GenericMethods__71.cpp
E:\XXXXXX\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\GenericMethods__71.cpp(4739): error C2440: 'type cast': cannot convert from 'NativeArray_1_tDB8B8DC66CC8E16ED6D9A8C75D2C1AFC80AC1E18' to 'NativeArray_1_tDB8B8DC66CC8E16ED6D9A8C75D2C1AFC80AC1E18 *'
E:\XXXXXX\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\GenericMethods__71.cpp(4739): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Any idea what can cause this issue?

May thanks

This might mean there are two different .NET assemblies (DLL files) in the project that have NativeArray defined. That should not be the case, but I wonder if some assembly was incorrect duplicated maybe.

Any idea on how I can investigate this? Where to look?

many thanks

Maybe take a look through the assemblies in the project. You can use a tool like ILSpy (https://github.com/icsharpcode/ILSpy) to inspect them, and check for types named NativeArray. You're looking for that type in the same namespace in two different assemblies.

I am also getting similar problem with IL2CPP build.

note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast```

any idea?
thanks

It seems like it might be the same issue. Can you follow the guidance about ILSpy given above?

I have done that and still no clue. It’s a unique type and no other type with similar name in the other assemblies.

Maybe this can give a clue for you (error line for il2cppoutput):

IL_00a8:
    {
        BinaryReader_t9A6D85F0FE9AE4EBB5E8D66997DFD1D84939E158* L_18 = ___0_p;
        MyAsset_1_tAF573C2869355D66156EC40310F75F9ED09CA9E2* L_19;
        L_19 = BakedEntryPoint_DeserializeType_MyAsset1_8_m69AF42B52DE8FC0308511B3A2C77678CF3D3E986(__this, L_18, NULL);
        return L_19;
    }

The game run perfectly in editor, but can’t build.

Thanks for investigating this. It might be a bug on the IL2CPP side then. Can you submit this project with a bug report? That will allow us to investigate it.

https://unity.com/releases/editor/qa/bug-reporting