未定义的引用`log’

我正在尝试编译Donald Eastlake的RFC 3797随机选择算法的实现(代码: http : //kambing.ui.ac.id/minix/other/rfc3797/ )。 但是,我收到链接器错误:

rfc3797.c:(.text+0xe7f): undefined reference to `log' 

我试图用提供的Makefile来实现它,它明确地链接到数学图书馆,但我仍然得到错误:

 cc -lm -o randomselection rfc3797.c MD5.c 

我该如何编译这个程序?

我不知道原因是什么,但如果你把-lm移到最后,它就会编译。

 $ cc -o randomselection rfc3797.c MD5.c -lm rfc3797.c: In function 'getinteger': rfc3797.c:183:3: warning: format not a string literal and no format arguments [-Wformat-security]