I'm trying to use libnftables in C on Raspberry Pi OS. The built-in man page, libnftables(3), says to use #include <nftables/libnftables.h>
. However, this header file doesn't seem to exist.
libnftables_test.c:2:10: fatal error: nftables/libnftables.h: No such file or directory
2 | #include <nftables/libnftables.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
find . -name "*libnftables*" -print
from the root directory, I can see the library is installed, but still no header file../usr/lib/arm-linux-gnueabihf/libnftables.so.1
./usr/lib/arm-linux-gnueabihf/libnftables.so.1.0.0
./usr/share/man/man5/libnftables-json.5.gz
./usr/share/man/man3/libnftables.3.gz
./usr/share/doc/libnftables1
./var/lib/dpkg/info/libnftables1:armhf.list
./var/lib/dpkg/info/libnftables1:armhf.md5sums
./var/lib/dpkg/info/libnftables1:armhf.triggers
./var/lib/dpkg/info/libnftables1:armhf.shlibs
sudo apt install libnftables1
did not help.How can I install/find the header file described in the man page?
You need to install the the -dev
version - i.e.
sudo apt install libnftables-dev
On Ubuntu, this includes:
$ dpkg-query -L libnftables-dev
/.
/usr
/usr/include
/usr/include/nftables
/usr/include/nftables/libnftables.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libnftables.pc
/usr/share
/usr/share/doc
/usr/share/doc/libnftables-dev
/usr/share/doc/libnftables-dev/copyright
/usr/share/doc/libnftables-dev/examples
/usr/share/doc/libnftables-dev/examples/nft-buffer.c
/usr/share/doc/libnftables-dev/examples/nft-json-file.c
/usr/lib/x86_64-linux-gnu/libnftables.so
/usr/share/doc/libnftables-dev/changelog.Debian.gz
which has the include file you're missing.