[Letux-kernel] v5.9-rc1 compile issue

H. Nikolaus Schaller hns at goldelico.com
Tue Aug 18 12:11:12 CEST 2020

> Am 18.08.2020 um 11:04 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> Ah, I think it may be my compiler hack to work around an issue with HOSTCC conflicts for sys/socket.h
> in scripts/selinux/genheaders/genheaders.c

Yes, it is.

The problem is that genheaders.c stumbles over fd_set and dev_t which may be available through HOSTCC
in an incompatible version.

  HOSTCC  scripts/selinux/mdp/mdp - due to missing .cmd file
In file included from include/uapi/linux/capability.h:17:0,
                 from include/linux/capability.h:16,
                 from ./security/selinux/include/classmap.h:3,
                 from scripts/selinux/mdp/mdp.c:36:
include/linux/types.h:15:26: error: conflicting types for 'fd_set'
 typedef __kernel_fd_set  fd_set;
In file included from /usr/include/sys/select.h:75:0,
                 from /usr/include/unistd.h:638,
                 from scripts/selinux/mdp/mdp.c:20:
/usr/include/sys/_types/_fd_def.h:48:3: note: previous declaration of 'fd_set' was here
 } fd_set;

Therefore I include <linux/compiler.h> and <uapi/linux/types.h> to get typedefs for __user and __u16 etc.

The new thing with v5.9-rc1 is that linux/compiler.h now includes <asm/rwonce.h> which doesn't exist
in HOSTCC context.

It turned out to be sufficient to change the include to <linux/compiler_types.h> to get rid of the
circular dependency.

To summarize: the problem occurs with HOSTCC tools that

#include <unistd.h>
#include "classmap.h"

which may lead to conflicting definitions of fd_set and dev_t if HOSTCC is not a GNU/Linux system.

Currently these are

So this was a weird bug :)

Thanks for all help,

More information about the Letux-kernel mailing list