This is an unusual post because there is no answer, just a warning to be aware. This issue has been experienced with AX2012 R2 CU7 with every version of kernel that has been tried.
When compiling the system, if you do a full system compile you might experience one of two issues, you get errors/warning or best practice issues, that when you compile the objects individually they compile fine. Alternatively the opposite also occurs, where the full system compile is reporting no errors, warnings or best practice issues, but when you compile individual objects you get errors.
There are a few posts on this kind of topic, and the suggestion is to compile each group of objects separately. So from the AOT select the ‘classes’ and compile from there.
However I have found issues with this one also. I have also experienced problems in projects, when you build a group for the class objects, add the classes you have changed to the project, then compile from the group, this still can cause issues.
Personally I always work with compile level 4, this is to keep my code as clean as possible, plus to ensure the best practices are followed as cleanly as possible, looking for variable declarations that have never been used, or select statements that are not efficiently built.
With the compiler producing inconstant results it is not always easy to ensure your system is cleanly compiled. The external compile does not help this issue either.
The only partial way I have found to mitigate this issue is to compile smaller blocks of objects. Select 50-100 classes and compile them. Move onto another set and repeat. This is obviously a tedious process, but if you are having issues with code compiles, you should consider recompile blocks of code to ensure everything is clean.