c++clinuxlinkerlibm

Undefined reference compiling OpenFP


I am using Ubuntu 14.04. I am trying to compile this project OpenFP. Issue is when after I run "configure" shell and use "make" to compile it I receive following error.

/usr/bin/ld: openfp_extract-fft.o: undefined reference to symbol 'cos@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[1]: *** [openfp_extract] Error 1 make[1]: Leaving directory `/home/murtaza/Desktop/openfp-1.3.2' make: *** [all] Error 2

The problem I believe is compiler unable to implicitly linking to "libm", but I really don't understand where to append -lm to make it work. I've tried on different locations in "makefile.am". But each time after configuration I get the same results. Any help will be appreciated.


Solution

  • It was the same error as I explained. glibc doesn't implicitly link to libm. and also order of placing -lm is important. You should place it in the very end. After configuration when it produced the Makefile, I appended -lm flag in LDFLAG variable. It worked