A common source of build failures related to bug 199856, occurs when emerge attempts to break a dependency cycle by merging a package which has a build time dependency that it assumes to be satisfied by an installed package. If the installed package that it assumes satisfies the dependency is broken in some way, such as due to its own dependencies being broken by an upgrade, then it can trigger a build failure. For example, the build failure related to bug 749777 occurred when emerge assumed that a qtgui dependency was satisfied even though the installed qtgui instance had been broken by a qtcore upgrade.
When emerge needs to assume that a dependency will be satisfied by an installed package, it can make a better choice if it prioritizes the importance of a given dependency based on various properties. Already, emerge's DepPrioritySatisfiedRange assigns higher priority to build time slot operator := dependencies. It will make better choices if this prioritization is based on finer-grained scoring, based on comparison of the installed package to its replacement(s):
1) In come cases, the installed package might be scheduled for uninstall in order to resolve a soft blocker. It's possible for a new slot to trigger uninstallation of an old slot in this way. A dependency on this sort of package should be given higher priority than most.
2) The installed package might be scheduled for rebuild or upgrade. Upgrades should have higher priority than plain rebuilds. Slot and subslot changes should increase priority. USE changes should also increase priority.