Skip to content

SYSTEM mode: misleading failures when host GCC/libstdc++ versions are incomplete (category B) #234

Description

@lm-sousa

Context

The system-header verification findings of 22 Aug 2026 separated SYSTEM-mode "file not found" errors into two independent causes:

The problem (F3 in the findings)

When parsing C++ in SYSTEM mode, Clang picks the newest installed GCC (gcc-N) and requires the matching libstdc++-N-dev headers. It does not fall back to an older, fully-installed GCC toolchain. So a machine with gcc-13 + a complete gcc-12/g++-12 fails on <string> after removing only libstdc++-13-dev, even though c++/12 headers are present and working.

This reproduces exactly (Ubuntu 24.04, clang 18): force-remove libstdc++-13-dev'string' file not found; reinstalling that single package fixes it immediately.

Historically these breakages were misdiagnosed: F2 shows installing libstdc++ packages can never repair a stddef.h failure — that was category A all along. Past fixes worked by accident or fixed only one of the two simultaneous errors.

What Clava should do

Per the findings' recommendations, Clava should diagnose, never paper over:

  1. Separate the categories before parsing starts, with two cheap probes:
  2. Reject unsupported combinations clearly: a libstdc++ newer than the supported/tested range should produce a single "unsupported combination" error instead of cascading parse errors.
  3. Consider surfacing the probe result in AUTO mode: today the libc probe runs the dumper bare, so on hosts where category B is present it just silently falls back to bundled includes — reasonable, but the user never learns why their explicit SYSTEM-mode parse fails.

References

Relevant existing machinery in this repo: ClangResources.detectLibC / LibcMode probing, and findSystemClangResourceDir.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions