Backported from RCPTT.

RCPTT commit: 55c03fe8a23336e6b41f2bfe327f343624ba5f59
Compilation fixes