gcc: how to link <math.h> ('-lm' don't work, i always used this switch...)

Christophe Kumsta christophe.kumsta at free.fr
Fri Nov 22 08:48:14 CET 2002


Hi,
  if you want to put math instruction in your module, I suggest you to add the compilation option :
 -ffast-math
Like that gcc will directly inline asm instruction for the arithmetic-coprocessor.

if the option -ffast-math does not work (I found this problem on an old red-hat distrib) you put in your C code directly :
#define __FAST_MATH__

chris.

>athlon:~/rtai_program/sine# gcc -c -D__KERNEL__ -DMODULE -I/usr/src/linux/include -I/usr/src/rtai-24.1.9/include rt_process.c -lm -o rt_process.o
>gcc: -lm: linker input file unused since linking not done
>
>module is create, but doing insmod:
>
>athlon:~/rtai_program/sine# insmod rt_process.o
>rt_process.o: unresolved symbol sin
>rt_process.o:
>Hint: You are trying to load a module without a GPL compatible license
>      and it has unresolved symbols.  Contact the module supplier for
>      assistance, only they can help you.







More information about the Rtai mailing list