1

I am trying to compile and build a certain set of wireless drivers using the instructions in this link, http://processors.wiki.ti.com/index.php/WL18xx_System_Build_Scripts

When I install a couple of modules, this is the error I get,

/root/build-utilites/fs/lib/libnl-3.a(utils.o): In function `nl_prob2int':
/root/build-utilites/src/libnl/lib/utils.c:378: undefined reference to `lrint'
collect2: ld returned 1 exit status
make: *** [all] Error 1
****** ERROR 0 *******

This is what the function, nl_prob2int (in /root/build-utilites/src/libnl/lib/ )looks like,

    long nl_prob2int(const char *str)
    {
            char *p;
            double d = strtod(str, &p);

            if (p == str)
                    return -NLE_INVAL;

            if (d > 1.0)
                    d /= 100.0f;

        if (d > 1.0f || d < 0.0f)
                return -NLE_RANGE;

        if (*p && strcmp(p, "%") != 0)
                return -NLE_INVAL;

        return rint(d * NL_PROB_MAX);
}

The following libraries are included in the utils.c code

#include <netlink-private/netlink.h>
#include <netlink/netlink.h>
#include <netlink/utils.h>
#include <linux/socket.h>
#include <stdlib.h> /* exit() */
#include <math.h>
bobbydf
  • 183
  • 1
  • 4
  • 13

1 Answers1

0

libnl depends on libm, but they are not in the correct order in the linker command line. (-lnl should be before -lm).

However, this is only manifesting in newer versions of GCC.... you probably have the "-Wl,--as-needed" flag in the linker command line. Remove it.

Erez
  • 1