[haiku-development] Re: missing -lm?

> One of the things I've seen come up more than once now in attempting
> ports is that they bomb out for a missing -lm.
> It's my understanding the this refers to libm which is a math
> library.
>  Is this included in one of Haiku's libraries?
> And is the workaround to include a Haiku library rather than -lm, and
> if so which one is it?

In Haiku (and BeOS), glibc and libm are both included in libroot and
linked to by default.
It is really wrong to assume library existence, be it libm.
But since we are the only Unixish OS around that doesn't have it, linux
freeks often think they can hardcode it.
The correct fix is to check for it at configure or compile time.
Remove the -lm from the makefiles, and you can usually add something
like:
AC_CHECK_LIB(m,sqrtf)
to the configure.ac or .in.
Sometimes you must add it to a custom FOOLIBS variable instead of LIBS,
but most of the time it should just work this way.

There is no reason we should add a hack to work around buggy software.
AFAIK libm is not mandated by any standard.

François.

Other related posts: