Skip to content

Stabilize CodeQL by pinning default compiler aliases to gcc-14 - #213

Merged
clauspruefer merged 2 commits into
mainfrom
copilot/fix-analyze-c-cpp-job-again
Aug 14, 2026
Merged

Stabilize CodeQL by pinning default compiler aliases to gcc-14#213
clauspruefer merged 2 commits into
mainfrom
copilot/fix-analyze-c-cpp-job-again

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The Analyze (c-cpp) job was still resolving the build through the runner’s generic compiler entrypoints, which allowed image drift to bypass the intended gcc-14/g++-14 toolchain. That made the CodeQL build unstable and led to recurring failures on #include <generator> despite the project compiling correctly on known-good environments.

  • Root cause

    • The workflow installed gcc-14 / g++-14, but did not force the generic aliases cc and c++.
    • In production, the CodeQL build path was still going through c++, so the effective compiler could change with the runner image.
  • What changed

    • Force all compiler entrypoints used by the job to the same toolchain:
      • gcc -> gcc-14
      • g++ -> g++-14
      • cc -> gcc-14
      • c++ -> g++-14
    • Update the CMake invocation to build through cc / c++ instead of naming gcc-14 / g++-14 directly, so the workflow follows the exact compiler path CodeQL uses in practice.
  • Why this is more stable

    • The workflow now controls both the explicit compiler binaries and the generic aliases the runner may use internally.
    • This removes dependence on whatever cc / c++ happen to point to after a GitHub runner image update.
  • Workflow shape

    sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-14 140
    sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 140
    sudo update-alternatives --set cc /usr/bin/gcc-14
    sudo update-alternatives --set c++ /usr/bin/g++-14
    
    cmake -B _build -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++

Copilot AI and others added 2 commits August 14, 2026 08:37
Co-authored-by: clauspruefer <17313789+clauspruefer@users.noreply.github.com>
Co-authored-by: clauspruefer <17313789+clauspruefer@users.noreply.github.com>
Copilot AI changed the title Force CodeQL to use gcc-14 default compiler aliases Stabilize CodeQL by pinning default compiler aliases to gcc-14 Aug 14, 2026
Copilot AI requested a review from clauspruefer August 14, 2026 08:46

@clauspruefer clauspruefer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that does not work, we will get a problem.

@clauspruefer
clauspruefer marked this pull request as ready for review August 14, 2026 08:51
Copilot AI lite review requested due to automatic review settings August 14, 2026 08:51
@clauspruefer
clauspruefer merged commit 59fc1b7 into main Aug 14, 2026
6 of 7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes the CodeQL Analyze (c-cpp) workflow by ensuring the generic compiler entrypoints (cc/c++) are pinned to the intended gcc-14/g++-14 toolchain, preventing GitHub runner image drift from changing the effective compiler used during CodeQL builds.

Changes:

  • Add update-alternatives entries and explicit --set calls for /usr/bin/cc and /usr/bin/c++ to point to gcc-14 / g++-14.
  • Update the build step to use CC=cc, CXX=c++, and configure CMake with -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++.
  • Expand diagnostic output to show which and version output for gcc, g++, cc, and c++.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants