Skip to content

Dual use (userspace/kernel) files are not clean enough for kernel inclusing when building on Deb 12/gcc 12/linux 6.1

When building models on Debian 12 (gcc 12, linux 6.1) the kernel build includes the -nostdinc flag. This means we do not have access to header files like stddef.h, stdalign.h, ...

This causes builds to fail.

ctest -R test-model-build -VV

35: make[2]: Entering directory '/usr/src/linux-headers-6.1.0-9-amd64'
35:   CC [M]  /home/jonathan.hanks/Documents/advLigoRTS/cmake-build-debug/test/build/models/x1iop/kernel_mod/x1iop_core.o
35: make[2]: Leaving directory '/usr/src/linux-headers-6.1.0-9-amd64'
35: make[1]: Leaving directory '/home/jonathan.hanks/Documents/advLigoRTS/cmake-build-debug/test/build/models/x1iop/kernel_mod'
35: In file included from /home/jonathan.hanks/Documents/advLigoRTS/src/include/controller.h:9,
35:                  from /home/jonathan.hanks/Documents/advLigoRTS/src/include/fe.h:6,
35:                  from /home/jonathan.hanks/Documents/advLigoRTS/cmake-build-debug/test/build/models/x1iop/kernel_mod/x1iop_core.c:4:
35: /home/jonathan.hanks/Documents/advLigoRTS/src/include/drv/shmem.h:11:10: fatal error: stddef.h: No such file or directory
35:    11 | #include <stddef.h>

Running with export KBUILD_VERBOSE=1, shows that -nostdinc is added to the build line by the kernel.

Edited by Jonathan Hanks