Incremental compilation depends on the constraints on environment (IE are you trying to incrementally produce normal object files or what)
The more you relax the environmental constraints the easier it gets.
It also depends on just how non-local an effect the programming language allows.
For most programming language, general incremental compilation requires either strongly overestimating possibly-modified sets, or global interprocedural dataflow + pointer analysis.
Most choose the former, or don't do general incremental, but instead something like "edits to functions are incremental, edits to global data/types/etc are not"
(This is even without compiler optimization on).