Fix stage2 and stage3 builds by linking properly.