2022-11-28 17:30:02

by H. Nikolaus Schaller

[permalink] [raw]
Subject: [BUG] Add missing <linux/string.h> include for strcmp.

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


2022-11-28 21:31:07

by Sam James

[permalink] [raw]
Subject: Re: [BUG] Add missing <linux/string.h> include for strcmp.



> On 28 Nov 2022, at 21:25, Andrew Morton <[email protected]> wrote:
>
> On Mon, 28 Nov 2022 18:15:55 +0100 "H. Nikolaus Schaller" <[email protected]> wrote:
>
>> 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.
>
> Thanks. I queued a reversion patch.

Thanks, I can't look into it properly right now so this is the best course of action. I'll test cross and the like then submit a fixed one in a few days.

2022-11-28 21:42:39

by Andrew Morton

[permalink] [raw]
Subject: Re: [BUG] Add missing <linux/string.h> include for strcmp.

On Mon, 28 Nov 2022 18:15:55 +0100 "H. Nikolaus Schaller" <[email protected]> wrote:

> 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.

Thanks. I queued a reversion patch.

2023-02-01 23:38:00

by Sam James

[permalink] [raw]
Subject: Re: [BUG] Add missing <linux/string.h> include for strcmp.

Finally getting back to this. Thanks for reporting the problem (we reverted it as a result, obviously).

Would you mind sharing a preprocessed version of the failing file please?

(Passing -save-temps to CC can do this, the relevant files should be xx.i)

Thanks.


Attachments:
signature.asc (358.00 B)
Message signed with OpenPGP

2023-02-02 08:55:26

by H. Nikolaus Schaller

[permalink] [raw]
Subject: Re: [BUG] Add missing <linux/string.h> include for strcmp.

Hi Sam,

> Am 02.02.2023 um 00:37 schrieb Sam James <[email protected]>:
>
> Finally getting back to this. Thanks for reporting the problem (we reverted it as a result, obviously).
>
> Would you mind sharing a preprocessed version of the failing file please?
>
> (Passing -save-temps to CC can do this, the relevant files should be xx.i)

Build v6.1-rc7 with ARCH=arm V=2 clean omap2plus_defconfig uImage

...
SYSTBL arch/arm/include/generated/calls-oabi.S - due to calls-oabi.S not in $(targets)
SYSTBL arch/arm/include/generated/calls-eabi.S - due to calls-eabi.S not in $(targets)
HOSTCC scripts/mod/mk_elfconfig - due to missing .cmd file
CC scripts/mod/empty.o - due to target missing
MKELF scripts/mod/elfconfig.h - due to: scripts/mod/empty.o scripts/mod/mk_elfconfig
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.
scripts/Makefile.host:128: recipe for target 'scripts/mod/modpost.o' failed
make[2]: *** [scripts/mod/modpost.o] Error 1
Makefile:1269: recipe for target 'prepare0' failed
make[1]: *** [prepare0] Error 2
Makefile:362: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2

Attached is the modpost.i
After the failed #include it is apparently incomplete.

BR and thanks,
Nikolaus


Attachments:
modpost.i (93.32 kB)