il2cpp.exe did not run properly!

I upgraded from 2019.1.11f1 to the 2019.4.10f1 LTS version. Now I can no longer build with IL2CPP.

At first it wouldnt recognise that Visual Studio 2019 or the C++ Workshop tools where installed.

After 6 hours of troubleshooting and taking the last steps of a clean install for Unity and Visual Studio 2019 Community, I’m at a wits end, and unable to resolve. Please help.

6340812--704415--upload_2020-9-23_15-30-49.png

Part 1

Failed running C:\Program Files\Unity\Hub\Editor\2019.4.10f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile=“unityaot” --compile-cpp --libil2cpp-static --platform=“WindowsDesktop” --architecture=“x64” --configuration=“Release” --outputpath=“I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Temp/StagingArea/Data\Native\GameAssembly.dll” --cachedirectory=“I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Assets..\Library/il2cpp_cache” --incremental-g-c-time-slice=3 --profiler-report --map-file-parser=“C:/Program Files/Unity/Hub/Editor/2019.4.10f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe” --directory=“I:/Projects/Unity/Absolute Territory Project/ProjectAries3D/Temp/StagingArea/Data/Managed” --generatedcppdir=“I:/Projects/Unity/Absolute Territory Project/ProjectAries3D/Temp/StagingArea/Data/il2cppOutput” --extra-types-file=“I:/Projects/Unity/Absolute Territory Project/ProjectAries3D/Temp/StagingArea/Data/extra-types.txt”
stdout:
Building GameAssembly.dll with MsvcDesktopToolChain
Msvc Install Version: 15.0
Msvc Install SDK Directory: C:\Program Files (x86)\Windows Kits\10
Msvc Linker Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.exe
Msvc Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\cl.exe
Output directory: I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Temp\StagingArea\Data\Native
Cache directory: I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Library\il2cpp_cache
ObjectFiles: 496 of which compiled: 0
Total compilation time: 600 milliseconds.
il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.exe /out:“I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Library\il2cpp_cache\linkresult_9C3DEB387BB9252D40B9C816C8ACF645\GameAssembly.dll” /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF /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” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64” /LIBPATH:“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\lib\x64” /SUBSYSTEM:WINDOWS @“C:\Users\Dan\AppData\Local\Temp\tmp4C29.tmp”
879D96608935AABCA4174C9880A71E18.obj : fatal error LNK1136: invalid or corrupt file
at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Program.DoRun(String[ ] args, List1 foundAssemblies)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)
stderr:
Unhandled Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.exe /out:“I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Library\il2cpp_cache\linkresult_9C3DEB387BB9252D40B9C816C8ACF645\GameAssembly.dll” /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /NXCOMPAT /DYNAMICBASE /NOLOGO /TLBID:1 /OPT:REF /OPT:ICF /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” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64” /LIBPATH:“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\lib\x64” /SUBSYSTEM:WINDOWS @“C:\Users\Dan\AppData\Local\Temp\tmp4C29.tmp”
879D96608935AABCA4174C9880A71E18.obj : fatal error LNK1136: invalid or corrupt file
at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(HashSet1 objectFiles, CppToolChainContext toolChainContext) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Program.DoRun(String[ ] args, List1 foundAssemblies)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1) UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List1, Action1, String) UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(Il2CppBuildPipelineData, String, String, Boolean) UnityEditorInternal.IL2CPPBuilder:Run() UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry)
DesktopStandalonePostProcessor:SetupStagingArea(BuildPostProcessArgs, HashSet`1)
DesktopStandalonePostProcessor:PostProcess(BuildPostProcessArgs)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Part 2

Exception: C:\Program Files\Unity\Hub\Editor\2019.4.10f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly!
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <8004fcc221b54f98ba547350ea71d812>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <8004fcc221b54f98ba547350ea71d812>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String workingDirectory) (at <8004fcc221b54f98ba547350ea71d812>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <8004fcc221b54f98ba547350ea71d812>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <8004fcc221b54f98ba547350ea71d812>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <8004fcc221b54f98ba547350ea71d812>:0)
DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) (at <8004fcc221b54f98ba547350ea71d812>:0)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <8004fcc221b54f98ba547350ea71d812>:0)
Rethrow as BuildFailedException: Exception of type ‘UnityEditor.Build.BuildFailedException’ was thrown.
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <8004fcc221b54f98ba547350ea71d812>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <8004fcc221b54f98ba547350ea71d812>: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 <8004fcc221b54f98ba547350ea71d812>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Here’s the error: “879D96608935AABCA4174C9880A71E18.obj : fatal error LNK1136: invalid or corrupt file”

Could you try nuking “I:\Projects\Unity\Absolute Territory Project\ProjectAries3D\Library\il2cpp_cache”?

Thanks for the reminder, I had done so many times, that I forgot to do so after a clean install.

Nuked the folder, then got this error:

il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: Rewired_Core9.cpp

Which then lead me to here about a new compiler bug with Visual Studio 2019 16.5 . Seems the 16.7.4 version I’m on sort of improved upon but crashes as per this new error above.

I applied the script attached to that post for a workaround. It solved the issue.

From that post, it says Unity is aware and in turn Microsoft, since its specifically a compiler issue we are all waiting on MS to resolve it.

Moral of the story, don’t upgrade stuff :slight_smile: