Skip to content

CI: build the MinGW Clang matrix without debug info - #5360

Open
nlohmann wants to merge 1 commit into
developfrom
claude/ci-mingw-debug-info
Open

CI: build the MinGW Clang matrix without debug info#5360
nlohmann wants to merge 1 commit into
developfrom
claude/ci-mingw-debug-info

Conversation

@nlohmann

@nlohmann nlohmann commented Aug 4, 2026

Copy link
Copy Markdown
Owner

The clang matrix in windows.yml fails intermittently while linking test-regression2_cpp20:

CMakeFiles\test-regression2_cpp20.dir/objects.a(unit-regression2.cpp.obj):unit-regression2.c:(.debug_info+0x16):
relocation truncated to fit: IMAGE_REL_AMD64_SECREL against `.debug_line'

Why this is not a code problem

  • The failure moves between matrix entries. On run 30912117075 clang (13.0.1) failed while 15.0.7, 16.0.6 and 19.1.7 linked the same binary fine. Re-running the same commit flipped it: 13.0.1 passed and 11.0.1 failed instead, with a byte-identical message.
  • It happens on unrelated branches. Run 30885925478 on claude/binary-writer-output-sinks hit the same error on the same target.
  • The siblings reported as failures in those runs are Error 130 (SIGINT) — fail-fast cancelling them, not real failures.

So it is the size of the debug sections that unit-regression2.cpp produces at C++20, not any one Clang version: the MinGW linker cannot relocate DW_AT_stmt_list into .debug_line once it grows past what a 32-bit SECREL relocation can address.

The change

Override CMAKE_CXX_FLAGS_DEBUG to -g0 for that matrix, so no debug sections are emitted and the relocation cannot occur. This is a categorical fix rather than a probabilistic one.

The jobs build the tests and run them under ctest; nothing consumes the debug info. doctest's failure output uses __FILE__/__LINE__, so --output-on-failure is unaffected.

Everything else about the Debug build is unchanged. Verified by configuring the project both ways:

default Debug:  CXX_FLAGS = -g  -std=gnu++11 ... -Wno-deprecated -Wno-float-equal
with -g0:       CXX_FLAGS = -g0 -std=gnu++11 ... -Wno-deprecated -Wno-float-equal

No optimization flag is added and NDEBUG stays undefined, so JSON_ASSERT remains active.

Result

Run 30921367054 on this branch: all nine clang matrix entries pass, including 11.0.1 and 13.0.1, the two that had been failing.

Job times are modestly better for the entries that previously ran to completion — 15.0.7 9m→8m, 16.0.6 9m→8m, 19.1.7 9m→7m.

Scope

Only the clang job is changed, because that is where the failure has been observed. The mingw job (GCC 12.2.0) uses the same linker and the same Debug build type, so it carries the same latent risk — I left it alone rather than change a job that is not failing.

Public API

No changes to the public API. This touches only .github/workflows/windows.yml; no library, test, or documentation source is modified.


  • The changes are described in detail, both the what and why.
  • An existing issue is referenced — none filed; the evidence is in the CI runs linked above.
  • All new code is covered by tests (no code change; the workflow itself is the test).
  • The documentation is updated (not applicable).
  • make amalgamate was run (not applicable — no header changes).

This pull request was written by Claude Code.

Linking test-regression2_cpp20 intermittently fails with

  unit-regression2.cpp.obj:(.debug_info+0x16): relocation truncated to
  fit: IMAGE_REL_AMD64_SECREL against `.debug_line'

The failure moves between matrix entries from run to run, and the same
commit can pass and fail on consecutive runs, so it is the size of the
debug sections rather than any one Clang version.

The jobs only build and run the tests, so override CMAKE_CXX_FLAGS_DEBUG
to drop the default -g. Everything else about the Debug build is
unchanged: no optimization flag is added and NDEBUG stays undefined, so
JSON_ASSERT remains active.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant