Why is libm needed for isnan()?

Rob Landley rob at landley.net
Mon Jan 23 21:27:54 UTC 2006


A question came up about busybox sort, which builds fine under glibc in "big" 
mode but won't against uClibc.

Here's a hello world example of the problem:

#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[])
{
  double d=0.0;

  printf("%d\n",isnan(d));

  return 0;
}

Compiling this on ubuntu "horny hedgehog" against glibc, I can go:

$ gcc hello.c
$ ./a.out
0
$ ldd a.out
                libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7eaf000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0xb7feb000)

And life is good.  But in the bug report I got, under uClibc isnan() requires 
libm or the build breaks.  I'd rather not add a gratuitous library dependency 
that glibc doesn't need, but I'd also rather not have unnecessary explicit 
checks for uClibc not being glibc.

Anyone care to venture an opinion?

Rob
-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the uClibc mailing list