[BUG] Add missing <linux/string.h> include for strcmp.
From: H. Nikolaus Schaller
Date: Mon Nov 28 2022 - 12:16:21 EST
Hi,
starting with v6.1-rc7 I can't build my tree any more:
HOSTCC scripts/mod/modpost.o - due to target missing
In file included from include/linux/string.h:5,
from scripts/mod/../../include/linux/license.h:5,
from scripts/mod/modpost.c:24:
include/linux/compiler.h:246:10: fatal error: asm/rwonce.h: No such file or directory
246 | #include <asm/rwonce.h>
| ^~~~~~~~~~~~~~
compilation terminated.
Bisect did show your patch as the first bad one:
commit 50c697215a8c "Add missing <linux/string.h> include for strcmp."
Reverting it makes compile succeed.
The problem is that HOSTCC is not necessarily the same compiler or even
architecture as CC and pulling in <linux/compiler.h> or <asm/rwonce.h>
files indirectly isn't a good idea then.
My toolchain is providing HOSTCC = gcc (MacPorts) and CC = arm-linux-gnueabihf
(built from gcc source) and all running on Darwin.
If I change the include to <string.h> I can then "HOSTCC scripts/mod/modpost.c"
but then it fails for "CC kernel/module/main.c" not finding <string.h>:
CC kernel/module/main.o - due to target missing
In file included from kernel/module/main.c:43:0:
./include/linux/license.h:5:20: fatal error: string.h: No such file or directory
#include <string.h>
^
compilation terminated.
So this should be a conditional include depending on CC vs. HOSTCC.
Or moved elsewhere.
BR and thanks,
Nikolaus