fix(fcode-utils): fix GCC 15/C23 build failure with -std=gnu17 overlay#15908
fix(fcode-utils): fix GCC 15/C23 build failure with -std=gnu17 overlay#15908dmcilvaney wants to merge 1 commit intomicrosoft:tomls/base/mainfrom
Conversation
fcode-utils 1.0.3 fails to build with GCC 15's default C23 mode due to: 1. typedef to 'bool' (a C23 keyword) in shared/types.h 2. K&R-style empty-parameter function pointers treated as zero-arg in C23 3. -Wincompatible-pointer-types promoted to error The upstream project is dormant (last release 2014). A partial fix exists as an unmerged PR: openbios/fcode-utils#32 Fedora is also affected — fcode-utils has failed all mass rebuilds since fc42 (fc42-4, fc43-5, fc44-6 all failed in Fedora Koji). The last successful Fedora build was 1.0.3-3.fc42, before the C23 transition. Add a spec-search-replace overlay to force -std=gnu17 in CFLAGS, restoring pre-C23 semantics. Move the component from an inline entry in components-full.toml to a dedicated comp.toml to hold the overlay. Validated: prep-sources clean, build succeeds, smoke-tested toke/detok/ romheaders in mock chroot.
There was a problem hiding this comment.
Pull request overview
This PR fixes GCC 15/C23 build failures in the fcode-utils package by adding a compiler flag overlay to force C17 mode. The fcode-utils project is dormant (last release 2014) and contains legacy code patterns (K&R-style function pointers and bool typedef) that are incompatible with GCC 15's default C23 semantics.
Changes:
- Moved fcode-utils from inline entry in components-full.toml to dedicated component file to accommodate the overlay
- Added spec-search-replace overlay to inject
-std=gnu17into CFLAGS, restoring pre-C23 compilation semantics - Included comprehensive documentation explaining the root cause, upstream status, and Fedora's handling of the issue
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| base/comps/fcode-utils/fcode-utils.comp.toml | New dedicated component file with overlay to force C17 mode via CFLAGS modification |
| base/comps/components-full.toml | Removed inline fcode-utils entry (moved to dedicated file) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [[components.fcode-utils.overlays]] | ||
| description = "Fix GCC 15/C23 build failures by forcing C17 mode for K&R-style function pointers and bool typedef" | ||
| type = "spec-search-replace" | ||
| regex = 'CFLAGS=.%\{optflags\}.' |
There was a problem hiding this comment.
The regex pattern uses . as a wildcard to match the quote characters around %{optflags}. While this works, it could be more precise by using literal quote characters instead. Consider changing the regex to use explicit quotes for better clarity and to avoid potential edge cases:
Change from:
regex = 'CFLAGS=.%\{optflags\}.'
To:
regex = 'CFLAGS="%\{optflags\}"'
This makes the pattern more explicit about matching double-quoted CFLAGS assignments. However, since you've already validated this with prep-sources and build testing, the current pattern is acceptable.
| regex = 'CFLAGS=.%\{optflags\}.' | |
| regex = 'CFLAGS="%\{optflags\}"' |
ddstreetmicrosoft
left a comment
There was a problem hiding this comment.
The only thing that requires this seems to be openbios, and the only thing that requires openbios seems to be qemu-system for PPC and Sparc...can we look at dropping fcode-utils and openbios instread of merging this?
@trungams can you double-check that i got the package deps right ^ |
Yep. That's what I got as well. Looks like we shouldn't need this package |
|
Thanks @ddstreetmicrosoft and @trungams ! I'm closing this PR and we'll handle it at the package list/dependency level |
fcode-utils 1.0.3 fails to build with GCC 15's default C23 mode due to:
The upstream project is dormant (last release 2014). A partial fix exists as an unmerged PR: openbios/fcode-utils#32
Fedora is also affected — fcode-utils has failed all mass rebuilds since fc42 (fc42-4, fc43-5, fc44-6 all failed in Fedora Koji). The last successful Fedora build was 1.0.3-3.fc42, before the C23 transition.
Add a spec-search-replace overlay to force -std=gnu17 in CFLAGS, restoring pre-C23 semantics. Move the component from an inline entry in components-full.toml to a dedicated comp.toml to hold the overlay.
Validated: prep-sources clean, build succeeds, smoke-tested toke/detok/ romheaders in mock chroot.