Skip to content

chore: Reproduce #903 on GitHub Actions (do not merge: reproduction only) - #904

Closed
krlmlr wants to merge 7 commits into
mainfrom
claude/repro-903
Closed

krlmlr wants to merge 7 commits into
mainfrom
claude/repro-903

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Do not merge: reproduction only. This branch holds a reproducer workflow for #903 (.github/workflows/repro-903.yaml) and the candidate fix as a patch file (.github/repro-903/configure.win.patch). Its commits are dropped as a unit; the fix itself goes to #905.

Result

#903 is reproduced, its theory holds, and the patch turns it from red to green. Runs: first reproduction https://github.com/r-dbi/RSQLite/actions/runs/46033237696, red then green with staged smoke tests https://github.com/r-dbi/RSQLite/actions/runs/46035565543.

  • main on R 4.2 (rtools42): unchanged LINK-FAIL (undefined reference to 'gai_strerrorW' from libcrypto.a(b_addr.o)), fixed OK, smoke test of the fixed build OK.
  • Pending 3.54.1 (claude/cran-release, chore: CRAN release of RSQLite 3.54.1 #893) on R 4.2: same as main. Its configure.win and src/Makevars equal main's.
  • CRAN 3.53.3 tarball on R 4.2: same as main (its unchanged link also misses __imp_gethostbyname and others from ws2_32).
  • main on R release (Rtools45): unchanged and fixed both OK, both smoke tests OK, same imported DLLs.

The smoke test loads the package from the freshly installed library, connects to an in-memory database, runs SELECT 1, and disconnects. The jobs of run 46035565543 show red only because a report step failed after the expected link failure; every verdict matched, and 65f9e94 stops the report steps from failing.

Cause

On rtools42, pkg-config finds no libcurl.pc, so configure.win falls back to curl-config. Its list names -lws2_32 several times, the last ones after -lcrypto. dedup_libs() keeps the first occurrence of each flag, which leaves -lws2_32 only before -lssl -lcrypto, and the static link drops it before libcrypto needs it:

Found libcurl (deduped): -L/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib -lcurl -lidn2 -lunistring -liconv -lcharset -lssh2 -lgcrypt -lgpg-error -lws2_32 -lz -ladvapi32 -lcrypt32 -lssl -lcrypto -lgdi32 -lwldap32 -lzstd -lpthread
C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools42/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/lib/libcrypto.a(b_addr.o):b_addr.c:(.text+0x233): undefined reference to `gai_strerrorW'

Two one-condition variants in the first run linked as well: the dedup disabled, and -lws2_32 appended at the end.

Fix

Revised after a clean review: the first candidate, keeping the last occurrence of each flag in dedup_libs(), turned the runs above green, but it can reorder a valid list into an invalid one (e.g. -lcurl -lssl -lcrypto -lws2_32 -lssl becomes -lcurl -lcrypto -lws2_32 -lssl) and moves position-dependent -Wl, flags. The patch now removes the dedup and passes the libcurl flags through in their original order, joined to one line. The first run already showed that the undeduped rtools42 list links. A run of the revised patch is pending; once green, the fix is ported to #905, which also adds Windows with R oldrel-4 to the CI matrix.

Notes

Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su


Generated by Claude Code

Builds RSQLite on windows-latest with R 4.2 and rtools42,
with R release as a control,
and with the CRAN 3.53.3 tarball and the claude/cran-release sources on R 4.2.
On R 4.2, two variants of configure.win test the link-order theory:
one without dedup_libs(), one appending -lws2_32 after the deduped libs.
Each build reports LINK-FAIL, OK, or OTHER-FAIL in the job summary.

Reproduction only: drop this commit before any fix merges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su

krlmlr commented Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: where does the fix for #903 go once it is green here?

The request was "Fix in the reproducer PR, then port to #904", but #904 is this reproducer PR itself, so I read the port target as #905, the PR that adds Windows oldrel-4 to the matrix. With the fix in #905, that PR adds the check and turns it green in one merge, and main's nightly never goes red on the new row. Until this is answered, I hold back the auto-merge of #905, because merging it without the fix would make the push and nightly runs on main red until #903 is fixed. If nobody answers, I port the fix to #905 once the red-then-green run here passes, and schedule the merge there.

Also: link #904 from a comment on #903? I post nothing on #903 without your OK.


Generated by Claude Code

@krlmlr krlmlr mentioned this pull request Nov 27, 2026
16 of 22 tasks
The fix lives in .github/repro-903/configure.win.patch:
dedup_libs() keeps the last occurrence of each token instead of the first,
so that every static library stays after everything that needs it.
Each job now builds the unchanged sources and the patched sources,
smoke-tests the patched build,
and asserts the verdicts in its last step.
The theory variants are gone, since run 46033237696 confirmed the link order.
The CRAN 3.53.3 job installs the tarball's own missing dependencies,
and the diagnostics also print curl-config output.

Reproduction only: drop these commits before the fix merges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su
The Rscript that installs the tarball's missing dependencies had no repository set,
so install.packages() failed in contrib.url().
It now uses the configured CRAN repository,
falls back to cloud.r-project.org,
and stops with the names of any dependency still missing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su
The fixed build crashed in its smoke test on R release,
and it is unclear whether the crash is the fix's or pre-existing.
Each successful build, unchanged and fixed, now gets its own smoke test,
run in stages with a marker file per stage,
and reports OK, CRASH, or FAIL.
The report also lists the DLLs that each installed RSQLite.dll imports.
The assertion requires both smoke tests to pass on R release
and the fixed one to pass on R 4.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su

krlmlr commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

Status of run https://github.com/r-dbi/RSQLite/actions/runs/46034648463 (patch in .github/repro-903/configure.win.patch, keep the last occurrence in dedup_libs()):

  • Link: red then green on R 4.2 for both main and 3.54.1 (LINK-FAIL unchanged, OK fixed). On R release both builds link.
  • Smoke test: loading the fixed build segfaults (exit 139) on R 4.2 and on R release. The smoke test ran only after the fixed build, so it is not yet known whether the unchanged build crashes the same way on R release, where it links.
  • cran-3.53.3-r4.2: still inconclusive, a workflow bug (no repos for install.packages()), fixed in 737116d.

The next run (f0ee0ec) smoke-tests both builds in stages (load, connect, query, disconnect) and lists the DLLs each build imports. The port to #905 waits for that result.


Generated by Claude Code

A report step failed after a build with many undefined references,
since the step shell runs with -e and pipefail
and a pipeline in report() returned non-zero.
report() now turns both off and its callers ignore its status:
the report steps only report, and the assert step decides.
The top comment also records the earlier segfault of the single-script smoke test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su
Keeping the last occurrence of each flag can still turn a valid link order into an invalid one,
and it breaks positional -Wl, flags.
The fix in .github/repro-903/configure.win.patch now removes dedup_libs() entirely
and passes the curl flags through in their original order,
joined into one line with single spaces, using printf rather than echo.
The workflow checks for the new code after applying the patch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd8LPouuFsDEK7at9Su
@krlmlr krlmlr closed this Nov 28, 2026
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