Fix errors when building with DEBUG=2

Fixes #8306. Please define DEBUG in UserBuildConfig or Jamfiles if
needed.