Add -pthread to linker flags in build script.