Library ordering is incorrect on systems with static linkage