Hello,
I have problems with drops and the std C mathematical library. For my project, I am working on a package which is linked against a static user-library. This library on itslef uses <math.h>, e.g. the functions sin, cos, pow, a.s.o. ..., and is linked by gcc with "-lm".
When linking the executable of the package without including "-lm" in "LIBS" of the package Makefile, simmilar output messages are generated:
../../../../../lib/x86_586/l4v2/my-user-lib.a(src_file.o): In function `myFunc': src_file.c:(.text+0x466): undefined reference to `log' src_file.o:(.text+0x477): undefined reference to `log' src_file.o:(.text+0x490): undefined reference to `pow' src_file.o:(.text+0x490): undefined reference to `sqrt' src_file.o:(.text+0x490): undefined reference to `cos' src_file.o:(.text+0x525): undefined reference to `__assert_fail' ...
I am linking in "l4env_freebsd" mode and the appropiate user-library is found, as I assume by the output message, but not the implementation of the <math.h> functions, which should come with a libm.a ...
Linking with "-lm" in the freebsd mode sends the following output:
../../../../../lib/x86_586/l4v2/my-user-lib.a(src_file.o): In function `myFunc': src_file.c:(.text+0x525): undefined reference to `__assert_fail' /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o): In function `__kernel_standard': : undefined reference to `__errno_location' /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o): In function `__kernel_standard': : undefined reference to `__errno_location' /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o): In function `__kernel_standard': : undefined reference to `__errno_location' /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o): In function `__kernel_standard': : undefined reference to `__errno_location' /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o): In function `__kernel_standard': : undefined reference to `__errno_location' /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o):: more undefined references to `__errno_location' follow /usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../../libm.a(k_standard.o): In function `__kernel_standard': : undefined reference to `__assert_fail' collect2: ld returned 1 exit status
Does anyone have any solution for this problem? I thought about searching another math library, which does not use standard C math functions and trying to compile it as a library in a drops package by including 'lib.mk' in the appropiate Makefile. I am not really shure, if this would really solve my problem, or just keep me fighting with other incompatibility problems. Is there no other possibility to use mathematical functions in any drops application, or perhaps another linkage concept or configuration? I hope for some replies ;-)
Vladimir