Fix thread linking for gtest under ubuntu.