Anonymous | Login | Signup for a new account | 11-10-2008 10:41 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0000133 | [uClibc] Math Library | minor | always | 03-06-05 10:19 | 12-08-05 12:36 | ||||
Reporter | jamie | View Status | public | ||||||
Assigned To | uClibc | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 0.9.27 | ||||||
Summary | 0000133: lrint, lrintf et al. math functions defined in headers but not in .so (breaks Xine) | ||||||||
Description |
#define _GNU_SOURCE #include <math.h> int main () { return lrintf (0.0); } This program fails to compile, citing a link time error, "undefined reference to `lrintf'". However, there is no compile time warning, because the function is declared, it just isn't implemented in libm.so or libm.a. The function _is_ implemented in <bits/mathinline.h>, however. If __USE_EXTERN_INLINES is added to the compiler flags, then this program compiles and runs fine. This omission breaks "Xine" (the audio/video player), where one of the codecs uses the lrintf() function. There are no compiler warnings because the function is declared, and in fact it builds fine because it's building a shared library; the problem is detected only at run time when the shared library cannot be loaded. Glibc, from which the header files are derived, does have a definition of this function and its relatives in libm.so and libm.a. (Glibc 2.3.4 or thereabouts). |
||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Notes | |
(0000073) jbrandmeyer 03-09-05 09:23 |
sinf and cosf suffer the same problem. GCC bug# 20353 is somewhat related to this problem. |
(0000078) jamie 03-09-05 10:15 |
The GCC bug is a bit different because GCC calls sinf and cosf even when the source program doesn't mention them, as an "optimisation". But yes, they are related. A quick hack for uclibc (not a perfect solution, but functional) for both these bugs would be: float lrintf (float x) { return (float) lrint ((double) x); } float sinf (float x) { return (float) sin ((double) x); } Although in the case of functions like lrintf(), it's probably better to enable the inlined implementations when optimising. |
(0000079) jbrandmeyer 03-09-05 16:08 |
lrintf remains outstanding, since lrint() is not defined, but it appears that sinf and cosf have been added by Mr. Anderson (using the technique you describe) a couple of days ago. |
(0000080) jamie 03-09-05 17:59 |
There is an implementation of lrint() (and other functions) available in <bits/mathinline.h>, which can be used in a slightly dirty way to make the library implementations: #include <math.h> #define __NTH(f) __ # f #include <bits/mathinline.h> long int lrintf (float x) { __lrintf (x); } long int lrint (double x) { __lrint (x); } long int lrintl (long double x) { __lrintl (x); } (Not tested). You get the idea. No need to write actual math functions. -- Jamie |
(0000084) psm 03-12-05 12:37 |
see bug 0000144 for full math support |
(0000753) vapier 12-08-05 12:36 |
latest svn has more math funcs |
Copyright © 2000 - 2006 Mantis Group |