  We study compactness for nonnegative solutions of the fourth order constant
$Q$-curvature equations on smooth compact Riemannian manifolds of dimension
$\ge 5$. If the $Q$-curvature equals $-1$, we prove that all solutions are
universally bounded. If the $Q$-curvature is $1$, assuming that Paneitz
operator's kernel is trivial and its Green function is positive, we establish
universal energy bounds on manifolds which are either locally conformally flat
(LCF) or of dimension $\le 9$. Moreover, assuming in addition that a positive
mass type theorem holds for the Paneitz operator, we prove compactness in
$C^4$. Positive mass type theorems have been verified recently on LCF manifolds
or manifolds of dimension $\le 7$, when the Yamabe invariant is positive. We
also prove that, for dimension $\ge 8$, the Weyl tensor has to vanish at
possible blow up points of a sequence of blowing up solutions. This implies the
compactness result in dimension $\ge 8$ when the Weyl tensor does not vanish
anywhere. To overcome difficulties stemming from fourth order elliptic
equations, we develop a blow up analysis procedure via integral equations.
