Fix linking order for static libs