fix: pass GCC include dir to NVIDIA make to resolve stdarg.h not found

Debian kernel build uses -nostdinc which strips GCC's own includes.
NVIDIA's nv_stdarg.h needs <stdarg.h> from GCC.
Pass -I$(gcc --print-file-name=include) via CFLAGS_MODULE.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-08 18:53:37 +03:00
parent 68b5e02a74
commit 0057686769

View File

@@ -84,9 +84,15 @@ done
echo "kernel source: $KERNEL_SRC"
# Build kernel modules
# CFLAGS_MODULE: add GCC include dir so NVIDIA's nv_stdarg.h can find stdarg.h.
# Kernel build uses -nostdinc which strips GCC's own includes; we restore it here.
GCC_INCLUDES=$(gcc --print-file-name=include 2>/dev/null || echo "")
echo "=== building kernel modules ($(nproc) cores) ==="
cd "$KERNEL_SRC"
make -j$(nproc) KERNEL_UNAME="$KVER" SYSSRC="$KDIR" modules 2>&1 | tail -5
make -j$(nproc) \
KERNEL_UNAME="$KVER" SYSSRC="$KDIR" \
${GCC_INCLUDES:+CFLAGS_MODULE="-I${GCC_INCLUDES}"} \
modules 2>&1 | tail -10
# Collect outputs
mkdir -p "$CACHE_DIR/modules" "$CACHE_DIR/bin" "$CACHE_DIR/lib"