Error Linking Math Library


I was trying to create an executable from the “hmmer” benchmark source code files after applying some optimization. I am running the following script -

while read line; do
clang -S -emit-llvm -DNDEBUG -DSPEC_CPU -o $line’.o’ $line’.c’
done < files.txt
while read line; do
opt -block-placement $line’.o’ -o $line’.o’
done < files.txt

#export LLVM_LIB_SEARCH_PATH=/usr/lib
llvm-link *.o -o out.o.linked
llc out.o.linked
gcc out.o.linked.s -o hmmer

**files.txt contains the name of the source files of the hmmer benchmark.

But “llc” gives me the following error -

/tmp/ccVq4r6d.o: In function PostprocessSignificantHit': out.o.linked:(.text+0xc1f6): undefined reference to log’
/tmp/ccVq4r6d.o: In function ParsePAMFile': out.o.linked:(.text+0xc556): undefined reference to log’

I tried setting the LLVM_LIB_SEARCH_PATH to find libm.a /, tried to use the -L option of llvm-ld, but same error. Also I tried to give “-L” option to llvm-link but it says “no such option”!! Anyone to help on this?

Thank you;

gcc out.o.linked.s -o hmmer

Try this instead:
   gcc out.o.linked.s -o hmmer -lm

Ciao, Duncan.