Steps to determine cause of AOT Cross Compile Failed

My Unity3D project was originally designed for the iOS. I stopped developing for it for the mean time and focused on Mac/Win/Web build. I’ve done a lot of changes since my last working iOS build. I want to test my latest build on the iOS but I get the following during AOT Cross Compile:

Cross compilation job Assembly-CSharp.dll failed.
UnityEngine.UnityException: Failed AOT cross compiler: /Applications/Unity/Unity.app/Contents/BuildTargetTools/iPhonePlayer/mono-xcompiler --debug --optimize=-linears --aot=full,asmonly,write-symbols,soft-debug,ficall,static,outfile=“Assembly-CSharp.dll.s” “Assembly-CSharp.dll” current dir : /Users/xeratol/Documents/Unity3DProjects/CholesteRUN/Temp/StagingArea/Data/Managed
result file exists: True
stdout:
stderr:

at UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile) [0x00000] in :0
at UnityEditor.MonoCrossCompile.CrossCompileAOT (BuildTarget target, System.String crossCompilerAbsolutePath, System.String assembliesAbsoluteDirectory, CrossCompileOptions crossCompileOptions, System.String input, System.String output, System.String additionalOptions) [0x00000] in :0
at UnityEditor.MonoCrossCompile+JobCompileAOT.ThreadPoolCallback (System.Object threadContext) [0x00000] in :0
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
[12656-aot+cross+compile+failed.png|12656]

I’m not exactly sure where to begin debugging since I’ve put a lot of changes since the iOS build.

I’d like to know, if this happened to you, where do you begin?

So, I don’t have any magic wand for you. Your script code is compiled into DLLs (assemblies) by the editor. When you build for iOS, these assemblies are converted into Arm machine code. This process is called AOT (ahead-of-time) compilation. Well, in fact, the Mono tools are spitting out Arm assembler, which is the Assembly-CSharp.dll.s file the error message talks about. So, your challenge is to figure out which script file is causing the failure. At least we know it’s a cs file. What I’d do to begin with, is look as see if the Assembly-CSharp.dll.s contains anything. It might be that this file contains arm assembler for lots of your scripts, and you might recognise strings that appear. (Poking through these files is not for the fainthearted, mind. Don’t worry if the file is meaningless, just look for strings. You’ll probably start to notice labels that end in a colon, that correspond to functions in your scripts.) Anyway, what I hope is that the file will contain Arm assembler, and you can use what’s in it to rule in scripts that the compiler processes without problems. Best case, you see some labels that correspond to a script file, and then the file will end, giving you some ideas about the function that caused the termination, or the file at least. Then again, it could be that Unity deletes this file when the error happens. Alternatively, the file might be written into a temp file which gets deleted when the compiler terminated. In which case, you’ll need to delete script files one at a time, and see what scripts allow you to make a build successfully.