Fixing problem with linking to libm on some Ubuntu systems (I see this on machine running 11.04, kernel 3.0.0-14-virtual).  Changing order of -lm on the command line seems to do the trick and should be tolerated in other environments.