Fix linking for linux

routed and datastore need pthread for sem_close().