more flags and lib reorder to link under linux