Fix compiler segfault with main function and -lib switch