fix the linking order of libraries