Apparently gcc -l argument order matters.