Compactification in first order gravity