I'm getting an error when using make to install a program. The full step that it fails on with error looks like this:
gcc -g -O2 -fopenmp -L/usr/lib -lcfitsio -lm -o lenstool_tab e_nfwg.o lenstool_tab.o midpnt.o nrutil.o polint.o qromo.o read_bin.o lenstool_tab.o: In function `main':
/usr/local/src/lenstool-6.8/table_src/lenstool_tab.c:73: undefined reference to `log'
/usr/local/src/lenstool-6.8/table_src/lenstool_tab.c:73: undefined reference to `log'
e_nfwg.o: In function `surfdens2':
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:133: undefined reference to `pow'
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:130: undefined reference to `sin'
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:138: undefined reference to `pow'
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:140: undefined reference to `sin'
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:140: undefined reference to `pow'
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:144: undefined reference to `sin'
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:144: undefined reference to `pow'
e_nfwg.o: In function `nfwg_kappa':
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:63: undefined reference to `pow'
e_nfwg.o: In function `scmass':
/usr/local/src/lenstool-6.8/table_src/e_nfwg.c:165: undefined reference to `pow'
collect2: error: ld returned 1 exit status
make[1]: *** [lenstool_tab] Error 1
make[1]: Leaving directory `/usr/local/src/lenstool-6.8/table_src'
make: *** [all-recursive] Error 1
So obviously there is a problem with linking to math library. I checked that these codes do contain #include<math.h>. The main cause of this problem seems to usually be from a lack of -lm at the compile command, but as you can see it appears in the above. I added the -lm to various parts of the makefile that seemed appropriate, but it didn't help. I'm including the makefile here in case it helps. Should I be modifying the makefile to fix this? I searched this problem on the web but no answers seemed to consider the makefile. I read a suggestion in another thread to modify config.status to include -lm, but it was not clear where to do that. I've installed this program on a Mac before without issue but now I'm using Ubuntu 14 and I get this error. Any help is much appreciated! Thanks.