• Editor
  • Spine 4.1.1 Internal Compiler Error C1001

  • تم التحرير
Related Discussions
...

When building our project for Windows with IL2CPP in Master configuration, we receive this error and the build fails.

When building with Release configuration, it works.
This was not the case with Spine 3.8

This is the passage in question

This is the full log:

Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\link.exe /out:"C:\...\Library\il2cpp_cache\linkresult_F838CBDDBBDEF0B79294960F9049719C\GameAssembly.dll" /ignore:4206 /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF /LTCG /HIGHENTROPYVA /DLL /IGNORE:4104 /NODEFAULTLIB:uuid.lib "kernel32.lib" "user32.lib" "advapi32.lib" "ole32.lib" "oleaut32.lib" "Shell32.lib" "Crypt32.lib" "psapi.lib" "version.lib" "MsWSock.lib" "ws2_32.lib" "Iphlpapi.lib" "Dbghelp.lib" "C:\Program Files\Unity\Hub\Editor\2020.3.36f1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\Variations\win64_nondevelopment_il2cpp\baselib.dll.lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\lib\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64" /SUBSYSTEM:WINDOWS @"C:\...\AppData\Local\Temp\tmp19B0.tmp"

Creating library C:\...\Library\il2cpp_cache\linkresult_F838CBDDBBDEF0B79294960F9049719C\GameAssembly.lib and object C:\...\Library\il2cpp_cache\linkresult_F838CBDDBBDEF0B79294960F9049719C\GameAssembly.exp
Generating code
C:\...\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\spine-unity.cpp(17628) : fatal error C1001: Internal compiler error.
(compiler file 'd:\A01\_work\3\s\src\vctools\Compiler\Utc\src\p2\main.c', line 212)
 To work around this problem, try simplifying or changing the program near the locations listed above.
If possible please provide a repro here: https://developercommunity.visualstudio.com 
Please choose the Technical Support command on the Visual C++ 
 Help menu, or open the Technical Support help file for more information

   at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet`1 objectFiles, CppToolChainContext toolChainContext)
   at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
   at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles)
   at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <786b546700bc48b68852821de5e46ca9>:0)
DesktopStandalonePostProcessor.RunIL2CPP (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, System.Collections.Generic.List`1[T] cppPlugins) (at <786b546700bc48b68852821de5e46ca9>:0)
DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) (at <786b546700bc48b68852821de5e46ca9>:0)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <786b546700bc48b68852821de5e46ca9>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <786b546700bc48b68852821de5e46ca9>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, 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 <786b546700bc48b68852821de5e46ca9>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Please show us 20-30 lines around spine-unity.cpp line 17628, or post the entire spine-unity.cpp file (which shouldn't contain any of your project's code).

The line is question is

L_3 = AtlasUtilities_SpineUnityFlipRect_m2A0DA15D65DB4738689DDE277CAB9501E34B0D46(L_1, L_2, /*hidden argument*/NULL);

This is the surrounding block:

// UnityEngine.Rect Spine.Unity.AttachmentTools.AtlasUtilities::GetUnityRect(Spine.AtlasRegion,System.Int32)
IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Rect_t7D9187DB6339DBA5741C09B6CCEF2F54F1966878  AtlasUtilities_GetUnityRect_mEE139611A7F133A1713B8AF10385D92D7F7AAAB9 (AtlasRegion_t82875C2D00A27CA4974B4D3529484CA9F57F8485 * ___region0, int32_t ___textureHeight1, const RuntimeMethod* method)
{
   static bool s_Il2CppMethodInitialized;
   if (!s_Il2CppMethodInitialized)
   {
      il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&AtlasUtilities_t40ECCE1F6B05F49380057A53B251735A68D94E54_il2cpp_TypeInfo_var);
      s_Il2CppMethodInitialized = true;
   }
   {
      // return region.GetSpineAtlasRect().SpineUnityFlipRect(textureHeight);
      AtlasRegion_t82875C2D00A27CA4974B4D3529484CA9F57F8485 * L_0 = ___region0;
      IL2CPP_RUNTIME_CLASS_INIT(AtlasUtilities_t40ECCE1F6B05F49380057A53B251735A68D94E54_il2cpp_TypeInfo_var);
      Rect_t7D9187DB6339DBA5741C09B6CCEF2F54F1966878  L_1;
      L_1 = AtlasUtilities_GetSpineAtlasRect_m7F8EDDBDA58CFA85B471A45D3C2C680B9516472C(L_0, (bool)1, /*hidden argument*/NULL);
      int32_t L_2 = ___textureHeight1;
      Rect_t7D9187DB6339DBA5741C09B6CCEF2F54F1966878  L_3;
      L_3 = AtlasUtilities_SpineUnityFlipRect_m2A0DA15D65DB4738689DDE277CAB9501E34B0D46(L_1, L_2, /*hidden argument*/NULL);
      return L_3;
   }
}

Thanks. I'm afraid on our end there's not much we can do. Unity's IL2CPP compiler generates C++ code from the C# sources which your specific version of MSVC can't compile. Please try to update the MSVC toolset component of your Visual Studio 2019 installation.

The problem is that this not only happens on my end but with Unity Cloud build as well

Ouch. In that case I'm unsure how to proceed. Our C# code isn't anything special, so it's not obvious how to change it so IL2CPP can generate C++ code that the bugged MSVC version can compile without an error. I suppose this is a bug that Unity needs to know about and fix? Harri, our local Unity wizard will have a look next week.

Sorry for the late reply, and sorry for the troubles!

We could reproduce this internal compile error on Unity versions 2020.3 and 2021.1, but no longer on recent Unity versions like 2021.3 or 2022.1. So if upgrading Unity is an option, you might want to consider this as a resolution.

Nevertheless, it seems that the internal compile error can be fixed by removing (commenting out) the method AtlasUtilities.GetUnityRect (this AtlasRegion region, int textureHeight) from AtlasUtilities.cs:
AtlasUtilities.cs#L676-L678.
So unless you use this method, you could simply commet out or remove the above lines from your local spine-unity source code.

Hey, thanks. I'll see what we'll do