Skip to content

Fix kernel source build on GCC 15+#377

Merged
jserv merged 1 commit into
sysprog21:masterfrom
linesight:fix-setup-gcc15
May 18, 2026
Merged

Fix kernel source build on GCC 15+#377
jserv merged 1 commit into
sysprog21:masterfrom
linesight:fix-setup-gcc15

Conversation

@linesight

@linesight linesight commented May 18, 2026

Copy link
Copy Markdown
Contributor

GCC 15 defaults to -std=c23 where bool/false/true are keywords, conflicting with the kernel's own typedefs. Pass -std=gnu11 via KCFLAGS, KCPPFLAGS, and HOSTCFLAGS so the flag reaches all compilation paths, including x86 sub-Makefiles (EFI stub, decompressor, real-mode setup) that rebuild KBUILD_CFLAGS from scratch with :=.

Also pass -Wno-error to override the kernel's -Werror (CONFIG_WERROR=y by default) so new compiler warnings, such as
-Wunterminated-string-initialization
don't break the build.


Summary by cubic

Fixes kernel source builds on GCC 15+ by using GNU11 across all compile paths and demoting -Werror so new warnings don’t break the build. Ensures bzImage and modules_prepare succeed on modern toolchains.

  • Bug Fixes
    • Pass -std=gnu11 via KCFLAGS, KCPPFLAGS, and HOSTCFLAGS to cover x86 sub-Makefiles (EFI stub, decompressor, real-mode).
    • Add -Wno-error to override kernel -Werror (CONFIG_WERROR=y), preventing failures from warnings like -Wunterminated-string-initialization.

Written for commit 1e48810. Summary will update on new commits. Review in cubic

GCC 15 defaults to -std=c23 where bool/false/true are keywords,
conflicting with the kernel's own typedefs.  Pass -std=gnu11 via
KCFLAGS, KCPPFLAGS, and HOSTCFLAGS so the flag reaches all
compilation paths, including x86 sub-Makefiles (EFI stub, decompressor,
real-mode setup) that rebuild KBUILD_CFLAGS from scratch with :=.

Also pass -Wno-error to override the kernel's -Werror (CONFIG_WERROR=y
by default) so new compiler warnings on intentional kernel patterns
don't break the build.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@jserv jserv merged commit 89c800f into sysprog21:master May 18, 2026
8 checks passed
@jserv

jserv commented May 18, 2026

Copy link
Copy Markdown
Contributor

Thank @linesight for contributing!

@linesight linesight deleted the fix-setup-gcc15 branch May 19, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants