Fixed compilation error on (some) Ubuntu systems: added pthread and rt flags for linking