Fix order of library linking (dependencies should come later).