Link with pthread (needed on ubuntu 12.04)