Return 0 if there's no main function.
Better error reporting for unit tests.
Link with libpthread.