Add -lpthread for Darwin