Add -lpthread in addition to -pthread on Linux.