Possibly -lm is in the wrong place