Apparently ALL -lm flags had to be set to a different place for it to compile properly