1

I am trying to use libnl 3 (http://www.infradead.org/~tgr/libnl/) under Ubuntu to use netlink in order to get some information from the IPv6 Neighbour Cache.

I am including a bunch of headers for this lib, but gcc already fails for the first one:

#include <libnl3/netlink/netlink.h>

There is no "main header", like libnl.h.

>$ gcc netlink_test.c 
In file included from netlink_test.c:11:0:
/usr/include/libnl3/netlink/netlink.h:24:36: fatal error: netlink/netlink-compat.h: No such file or directory
compilation terminated.

The file netlink.h includes "netlink/netlink-compat.h". Unfortunately, there is no "/usr/include/netlink/" folder. There is only "/usr/include/libnl3/netlink/"

Including "netlink/netlink.h" thus gives me:

netlink_test.c:10:29: fatal error: netlink/netlink.h: No such file or directory
compilation terminated.

I have installed the following packages under Ubuntu 12.04:

libnl-3-200
libnl-3-200-dbg
libnl-3-dev
libnl-3-doc
libnl-genl-3-200
libnl-genl-3-200-dev
libnl-route-3-200
libnl-route-3-200-dev

Am I missing here something or is this genuinely broken?

Flexo
  • 87,323
  • 22
  • 191
  • 272
Benjamin Maurer
  • 3,602
  • 5
  • 28
  • 49

1 Answers1

7

OK, so the package is not broken, I am ;)

A short while ago, they introduced a mechanism to enable users to install different versions of this library. Now you can configure it using "pkg-config" or just pass the precise directory to the compiler with "-I /usr/include/libnl3/". And it works.

Benjamin Maurer
  • 3,602
  • 5
  • 28
  • 49
  • I have the same error except I am doing cross-compiling. I have to precisely direct the compiler with "-I/usr/include/libnl3". – Oliver Mar 04 '20 at 22:43