I’m compiling linux kernel 6.2.16 using gcc. I run compilation using command make V=1
, and I got these really weird errors:
In file included from ./include/linux/rcupdate.h:26,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from ./include/linux/sched/task_stack.h:9,
from ./include/linux/elfcore.h:7,
from ./include/linux/crash_core.h:6,
from ./include/linux/kexec.h:18,
from ./include/linux/crash_dump.h:5,
from arch/x86/kernel/e820.c:12:
./include/linux/irqflags.h:180:2: error: invalid preprocessing directive #tefine; did you mean #define?
180 | #define raw_local_irq_restore(flags)
| ^~~~~~
| define
./arch/x86/include/asm/special_insns.h: In function ‘native_load_gs_index’:
./include/linux/irqflags.h:178:25: error: implicit declaration of function ‘arch_local_irq_sqve’; did you mean ‘arch_local_irq_save’? [-Werror=implicit-function-declaration]
178 | flags = arch_local_irq_save();
| ^~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:244:38: note: in expansion of macro ‘raw_local_irq_save’
244 | #define local_irq_save(flags) do { raw_local_irq_save(flags); } while (0)
| ^~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/special_insns.h:129:9: note: in expansion of macro ‘local_irq_save’
129 | local_irq_save(flags);
| ^~~~~~~~~~~~~~
./include/linux/irqflags.h:245:39: error: implicit declaration of function ‘raw_local_irq_restore’; did you mean ‘arch_local_irq_restore’? [-Werror=implicit-function-declaration]
245 | #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
| ^~~~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/special_insns.h:131:9: note: in expansion of macro ‘local_irq_restore’
131 | local_irq_restore(flags);
| ^~~~~~~~~~~~~~~~~
In file included from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:9,
from ./include/linux/preempt.h:78,
from ./include/linux/rcupdate.h:27,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from ./include/linux/sched/task_stack.h:9,
from ./include/linux/elfcore.h:7,
from ./include/linux/crash_core.h:6,
from ./include/linux/kexec.h:18,
from ./include/linux/crash_dump.h:5,
from arch/x86/kernel/e820.c:12:
./arch/x86/include/asm/thread_info.h: At top level:
./arch/x86/include/asm/thread_info.h:156:2: error: invalid preprocessing directive #ivndef; did you mean #ifndef?
156 | #ifndef __ASSEMBLY__
| ^~~~~~
| ifndef
./arch/x86/include/asm/thread_info.h:167:7: error: expected ‘;’ before ‘inline’
167 | static inline int arch_within_stack_frames(const void * const stack,
| ^
| ;
./arch/x86/include/asm/thread_info.h:237:2: error: #endif without #if
237 | #endif /* _ASM_X86_THREAD_INFO_H */
| ^~~~~
In file included from ./include/linux/rcupdate.h:26,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from ./include/linux/sched/task_stack.h:9,
from ./include/linux/elfcore.h:7,
from ./include/linux/crash_core.h:6,
from ./include/linux/kexec.h:18,
from ./include/linux/crash_dump.h:5,
from arch/x86/kernel/e820.c:12:
./include/linux/rcupdate.h: In function ‘rcu_read_lock_sched_held’:
./include/linux/irqflags.h:189:25: error: ‘arch_local_save_flags8’ undeclared (first use in this function); did you mean ‘arch_local_save_flags’?
189 | flags = arch_local_save_flags();
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:358:17: note: in expansion of macro ‘preemptible’
358 | return !preemptible();
| ^~~~~~~~~~~
./include/linux/irqflags.h:189:25: note: each undeclared identifier is reported only once for each function it appears in
189 | flags = arch_local_save_flags();
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:358:17: note: in expansion of macro ‘preemptible’
358 | return !preemptible();
| ^~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected ‘;’ before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:358:17: note: in expansion of macro ‘preemptible’
358 | return !preemptible();
| ^~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected statement before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:358:17: note: in expansion of macro ‘preemptible’
358 | return !preemptible();
| ^~~~~~~~~~~
./include/linux/rcupdate.h: In function ‘rcu_read_lock_any_held’:
./include/linux/irqflags.h:189:25: error: ‘arch_local_save_flags8’ undeclared (first use in this function); did you mean ‘arch_local_save_flags’?
189 | flags = arch_local_save_flags();
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:363:17: note: in expansion of macro ‘preemptible’
363 | return !preemptible();
| ^~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected ‘;’ before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:363:17: note: in expansion of macro ‘preemptible’
363 | return !preemptible();
| ^~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected statement before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/linux/preempt.h:215:51: note: in expansion of macro ‘irqs_disabled’
215 | #define preemptible() (preempt_count() == 0 && !irqs_disabled())
| ^~~~~~~~~~~~~
./include/linux/rcupdate.h:363:17: note: in expansion of macro ‘preemptible’
363 | return !preemptible();
| ^~~~~~~~~~~
In file included from ./include/linux/rcupdate.h:26,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from ./include/linux/sched/task_stack.h:9,
from ./include/linux/elfcore.h:7,
from ./include/linux/crash_core.h:6,
from ./include/linux/kexec.h:18,
from ./include/linux/crash_dump.h:5,
from arch/x86/kernel/e820.c:12:
./include/acpi/platform/aclinuxex.h: In function ‘acpi_os_allocate’:
./include/linux/irqflags.h:189:25: error: ‘arch_local_save_flags8’ undeclared (first use in this function); did you mean ‘arch_local_save_flags’?
189 | flags = arch_local_save_flags();
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:52:30: note: in expansion of macro ‘irqs_disabled’
52 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected ‘;’ before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:52:30: note: in expansion of macro ‘irqs_disabled’
52 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected statement before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:52:30: note: in expansion of macro ‘irqs_disabled’
52 | return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h: In function ‘acpi_os_allocate_zeroed’:
./include/linux/irqflags.h:189:25: error: ‘arch_local_save_flags8’ undeclared (first use in this function); did you mean ‘arch_local_save_flags’?
189 | flags = arch_local_save_flags();
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:57:30: note: in expansion of macro ‘irqs_disabled’
57 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected ‘;’ before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:57:30: note: in expansion of macro ‘irqs_disabled’
57 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected statement before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:57:30: note: in expansion of macro ‘irqs_disabled’
57 | return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h: In function ‘acpi_os_acquire_object’:
./include/linux/irqflags.h:189:25: error: ‘arch_local_save_flags8’ undeclared (first use in this function); did you mean ‘arch_local_save_flags’?
189 | flags = arch_local_save_flags();
| ^~~~~~~~~~~~~~~~~~~~~~
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:68:34: note: in expansion of macro ‘irqs_disabled’
68 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected ‘;’ before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:68:34: note: in expansion of macro ‘irqs_disabled’
68 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
./include/linux/irqflags.h:189:47: error: expected statement before ‘)’ token
189 | flags = arch_local_save_flags();
| ^
./include/linux/irqflags.h:261:17: note: in expansion of macro ‘raw_local_save_flags’
261 | raw_local_save_flags(_flags);
| ^~~~~~~~~~~~~~~~~~~~
./include/acpi/platform/aclinuxex.h:68:34: note: in expansion of macro ‘irqs_disabled’
68 | irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: arch/x86/kernel/e820.o] Error 1
make[2]: *** [scripts/Makefile.build:504: arch/x86/kernel] Error 2
make[1]: *** [scripts/Makefile.build:504: arch/x86] Error 2
make: *** [Makefile:2021: .] Error 2
As everyone can see, the error given by gcc does not match the source code, for example, it says #define
is #tefine
.
I tried to compile the same code on a remote server, and it finished nice. I only get this kind of error on my own computer. What might happened and what should I do? Does it relate to my hardware?
P.S. My computer is using r5-2600x as cpu, 8G*2 memory. GCC version 11.4.0. System Ubuntu 22.04 LTS (not Ubuntu pro). Kernel 5.15.0-130-generic.
Lee Flager is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1