As per comment, I assume for you a (real) Lie algebra is called compact by definition iff it is reductive with the semisimple part having negative definite Killing form. Cf. this related question.
So assume that $\mathfrak g^\mathbb R \simeq \mathfrak{s} \oplus \mathfrak{z}$ (as real Lie algebras) with $\mathfrak{s}$ semisimple, and $\mathfrak{z}$ the centre of $\mathfrak{g}$ = the centre of $\mathfrak{g}^{\mathbb R}$. Note that $\mathfrak{s} = [\mathfrak{g}^{\mathbb R}, \mathfrak{g}^{\mathbb R}] = [\mathfrak{g}, \mathfrak{g}]$ (not as trivial as it seems, but taking the real or complex span here gives the same result). So $\mathfrak{s}$ is actually a complex semisimple Lie algebra, so in fact this decomposition is one of complex Lie algebras as well.
If $B(x,y)$ is the Killing form of any complex Lie algebra, then the Killing form of its realification is given by twice the real part of that,
$B^{\mathbb R}(x,y) = 2\cdot Re(B(x,y))$ (cf. discussion in comments here).
Now as soon as $B(x,x) <0$, we get $B(ix,ix) >0$, so the Killing form on $\mathfrak s$ (be it $B$ or $B^{\mathbb R}$) has no chance to be negative definite unless $\mathfrak s=0$.