Skip to contentSkip to conversation

Building libnetfilter_queue has required kernel headers for some time

DISCUSSION Duncan Roe 2 participants 2 messages Oct 12, 2024 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

Hi Pablo,

Just to clear up a misconception:

Quoted 4 lines · Pablo Neira Ayuso

To ensure that a project compiles standalone (without the need for the system kernel header files), you can cache a copy of the header in your software tree (we use this trick for a while in userspace netfilter software).

The concept of a standalone build without kernel headers might have been valid once, but is invalid nowadays.

I tried uninstalling the kernel-headers package and building. I got the following 2 errors from multiple source files:

| In file included from /usr/include/errno.h:28,
|                  from libnetfilter_queue.c:29:
| /usr/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory
|    26 | # include <linux/errno.h>
|       |           ^~~~~~~~~~~~~~~
| In file included from /usr/include/sys/socket.h:33,
|                  from /usr/include/netinet/in.h:23,
|                  from /usr/include/arpa/inet.h:22,
|                  from nlmsg.c:9:
| /usr/include/bits/socket.h:354:11: fatal error: asm/socket.h: No such file or directory
|   354 | # include <asm/socket.h>
|       |           ^~~~~~~~~~~~~~

To see if an older version of glibc didn't use kernel headers, I tried a build from my Slackware 14.2 VM (2016-06-30). It failed in ./configure:

| checking how to run the C preprocessor... /lib/cpp
| configure: error: in `/dimstar/usr/src/libnetfilter_queue':
| configure: error: C preprocessor "/lib/cpp" fails sanity check
| See `config.log' for more details
config.log shows:
| | /* end confdefs.h.  */
| | #ifdef __STDC__
| | # include <limits.h>
| | #else
| | # include <assert.h>
| | #endif
| |                    Syntax error
| configure:8489: /lib/cpp  conftest.c
| In file included from /usr/include/bits/posix1_lim.h:160:0,
|                  from /usr/include/limits.h:143,
|                  from /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/include-fixed/limits.h:168,
|                  from /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/include-fixed/syslimits.h:7,
|                  from /usr/lib64/gcc/x86_64-slackware-linux/5.3.0/include-fixed/limits.h:34,
|                  from conftest.c:12:
| /usr/include/bits/local_lim.h:38:26: fatal error: linux/limits.h: No such file or directory

Cheers ... Duncan.

#1 lore raw
Quoted 4 lines · Duncan Roe

Hi Pablo,

Just to clear up a misconception:

Quoted 8 lines
Quoted 4 lines · Pablo Neira Ayuso

To ensure that a project compiles standalone (without the need for the system kernel header files), you can cache a copy of the header in your software tree (we use this trick for a while in userspace netfilter software).

The concept of a standalone build without kernel headers might have been valid once, but is invalid nowadays.

I am referring to netlink uapi files...