fix: add -D_GNU_SOURCE to CFLAGS for strcasestr visibility on Linux#111
Merged
DeusData merged 1 commit intoDeusData:mainfrom Mar 23, 2026
Merged
Conversation
Owner
|
Merged to main. Thanks @trollkotze — clean one-liner fix for a real build failure on mainstream Linux (glibc + -std=c11). The thorough explanation in the PR body with the _GNU_SOURCE analysis across platforms was a nice touch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description generated by AI (Claude Opus 4.6), with some human commentary at the bottom.
Problem
Build fails on Linux (tested: Mint 21.2, glibc 2.35, gcc 11.4) with:
, where cbm_strcasestr maps to strcasestr on non-Windows.
Root cause
The build uses -std=c11 which defines STRICT_ANSI, suppressing GNU extensions. _DEFAULT_SOURCE is intended to re-enable them, but strcasestr is a GNU extension that requires _GNU_SOURCE on some glibc configurations.
Fix
Add -D_GNU_SOURCE to CFLAGS_COMMON in Makefile.cbm. This is safe on all platforms: it's a superset of _DEFAULT_SOURCE on glibc, a no-op on macOS/BSD, and recognized by musl. The Windows codepath is unaffected (uses its own cbm_strcasestr implementation).
Human commentary (by me)
Here some clariying conversation with my AI slave (Claude Opus 4.6) who came up with this fix:
Me:
AI slave (Opus 4.6):