I think we need -pthread here, not just -lpthread