Fix Linux build (C23 bool, strlcpy, parallel yacc header, gettext/msgfmt, byacc) - #116
Open
chenrui333 wants to merge 5 commits into
Open
Fix Linux build (C23 bool, strlcpy, parallel yacc header, gettext/msgfmt, byacc)#116chenrui333 wants to merge 5 commits into
chenrui333 wants to merge 5 commits into
Conversation
C23 makes bool a keyword; rename the local variables in xo_filter.c so the XPath filter builds with C23 compilers (e.g. GCC 15+). Signed-off-by: Rui Chen <rui@chenrui.dev>
strlcpy/strlcat are not universally declared (e.g. glibc does not expose them without _DEFAULT_SOURCE), leaving them undefined at link time. Use snprintf/strncat, which are standard C. Signed-off-by: Rui Chen <rui@chenrui.dev>
xo_xpath.{o,lo} include xo_xpath.tab.h but lacked a prerequisite on it, racing under parallel make. Add the missing dependency.
Signed-off-by: Rui Chen <rui@chenrui.dev>
On glibc, gettext lives in libc with no separate libintl, so the -lintl link probes failed and the msgfmt check aborted even when gettext is usable. Detect whether -lintl is needed, add <stddef.h> so NULL is defined, gate the msgfmt lookup on gettext being present, and also search PATH for msgfmt. Overlaps Juniper#114 and Juniper#115. Signed-off-by: Rui Chen <rui@chenrui.dev>
The XPath grammar uses byacc extensions (reentrant parser exposing yystate and byacc-generated tables) that GNU bison does not provide. Drop the misleading 'bison -y' fallback and fail configure clearly when byacc is unavailable or the detected yacc is bison. Signed-off-by: Rui Chen <rui@chenrui.dev>
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.
Fix building libxo on Linux with a modern toolchain (GCC 16 / C23, parallel
make, glibc).Linux build failures & root causes
boolis used as an identifier in the XPath filter, which C23 makes a keyword. Renamed the locals (filter/xo_filter.c)._DEFAULT_SOURCE), so they were left undefined at link. Replaced with standardsnprintf/strncat(libxo/xo_syslog.c,tests/gettext/gt_01.c).xo_xpath.{o,lo}include the generatedxo_xpath.tab.hbut had no prerequisite on it, racing undermake -j. Added the dependency (filter/Makefile.am).libintl; on glibc gettext lives in libc, so the-lintlprobes failed and themsgfmtcheck aborted even when gettext is usable. Detect whether-lintlis needed, add<stddef.h>soNULLis defined, gate themsgfmtlookup on gettext being present, and also searchPATH. Overlaps Fix undefined NULL in gettext() configure snippets #114 and configure.ac: don't require msgfmt when --disable-gettext is passed #115 — their fixes are incorporated/credited here.yystate+ byacc-generated tables) that GNU bison does not provide. Removed the misleadingbison -yfallback and madeconfigurefail clearly when byacc is unavailable.Validation
Linux, GCC 16, byacc: bootstrap +
configure(gettext enabled on glibc) + parallelmake -j4+make testall pass.configure YACC=bisonnow fails with a clear "byacc is required" error. macOS/FreeBSD are unaffected (theiryaccis byacc).References