fix: declare R_getRegisteredNamespace() so the C23 sanitizer build compiles#2749
Closed
krlmlr wants to merge 0 commit into
Closed
fix: declare R_getRegisteredNamespace() so the C23 sanitizer build compiles#2749krlmlr wants to merge 0 commit into
R_getRegisteredNamespace() so the C23 sanitizer build compiles#2749krlmlr wants to merge 0 commit into
Conversation
krlmlr
force-pushed
the
claude/fix-cicd-failures-63v5pe
branch
from
July 22, 2026 20:58
db3422a to
dbf1f50
Compare
R_getRegisteredNamespace() to fix R-devel C23 buildR_FindNamespace() for the igraph namespace lookup
krlmlr
force-pushed
the
claude/fix-cicd-failures-63v5pe
branch
from
July 23, 2026 15:10
9bf5e75 to
96802ac
Compare
R_FindNamespace() for the igraph namespace lookupR_getRegisteredNamespace(), from the correct include
krlmlr
force-pushed
the
claude/fix-cicd-failures-63v5pe
branch
from
July 23, 2026 15:32
96802ac to
0bf1b77
Compare
R_getRegisteredNamespace(), from the correct includeR_FindNamespace() so the C23 sanitizer build compiles
krlmlr
force-pushed
the
claude/fix-cicd-failures-63v5pe
branch
from
July 23, 2026 16:07
0bf1b77 to
cc2a927
Compare
R_FindNamespace() so the C23 sanitizer build compilesR_getRegisteredNamespace() so the C23 sanitizer build compiles
krlmlr
force-pushed
the
claude/fix-cicd-failures-63v5pe
branch
from
July 24, 2026 09:22
cc2a927 to
0055d78
Compare
This was referenced Jul 24, 2026
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.
LLM disclosure: this PR was prepared with Claude Code (Claude Opus 4.8).
What
Fix the
R_getRegisteredNamespacecompile error in theSanitizerjob ofbuild-and-check.ymlwithout changing the function used — the original call is correct.Root cause (verified against the logs)
The
R >= 4.6.0fast path insrc/rinterface_extra.clooks up theigraphnamespace withR_getRegisteredNamespace("igraph")at three sites. That function is correct, public R API:Writing R Extensionsdocuments it (@eapifun, "R 4.6.0 addsR_getRegisteredNamespace… find and return the namespace environment registered for a name") as the supported replacement for the non-APIR_NamespaceRegistry, its signature isconst char *, and it is a side-effect-free registry lookup (unlikeR_FindNamespace(), which evaluatesgetNamespace()and loads the namespace).The Sanitizer job builds against a CSAN R-devel image whose headers report
R >= 4.6.0(so the fast path is compiled) but predate the declaration being added to<Rinternals.h>. Proof from the same build log:R_getVar()— from the same header, added in R 4.5.0 — compiles, whileR_getRegisteredNamespace()— added in R 4.6.0 — does not. Underclang -std=gnu2x(C23) an implicit declaration is a hard error:libRdoes export the symbol — the non-C23 R-devel jobs (e.g.rcc: ubuntu-26.04 (devel)) compile and link the same call, only warning — so this is purely a missing header declaration on that one snapshot.Fix
<Rinternals.h>is already included unconditionally viasrc/rinterface.h, and it is the only header that ever declares this entry point — so adding an#includecannot help a snapshot whose header lacks the line. Instead, declare the prototype locally in theR >= 4.6.0branch:It matches R's signature exactly, so it is a compatible redeclaration wherever the installed header already provides it, and it supplies the missing declaration where it does not. The
R < 4.6.0getNamespace()fallback is unchanged. Net change vsmain: the prototype line (plus comments) at the three sites.Verification
Reproduced locally with R 4.5.3 headers (which, like the CSAN snapshot, do not declare the function):
error: implicit declaration of function 'R_getRegisteredNamespace'undergcc -std=gnu2x -Werror=implicit-function-declaration— the same failure as CI.-Wall -Wextra -std=gnu2x).The Sanitizer workflow is also dispatched against this branch to confirm end-to-end on the real CSAN image.
Not addressed here (separate, not this compile bug)
rcc: ubuntu-26.04 (4.2)/(4.3)—pakresolution fails on removed Bioconductor releases (Enhances: graph) 404ing on the Posit mirror. Environmental.rcc: * (devel)check failures — those jobs compile fine (examples run); they fail later inR CMD checkon an R-devel check condition unrelated to this compile error.🤖 Generated with Claude Code