Fix for building in debug mode ensure that pthread is linked