Set matching CC alongside CXX in Linux CI matrix#4863
Conversation
The Configure step only set CXX, so CMake's C compiler detection fell back to whatever the default happened to be on the runner, independent of which C++ compiler the matrix entry was actually testing (e.g. CXX=clang++-3.6 but CC left to detect GCC 11). Derive CC from the same matrix.cxx value the job already installs a matching compiler for.
|
The I don't have permission to re-run just the failed jobs (not a repo admin) — happy to push an empty commit to retrigger if useful, or this should resolve on its own next time CI runs against this branch. |
|
I triggered a re-run. |
Fixes #4858
Problem
The Linux CI matrix deliberately varies
matrix.cxxacross old and new compilers (g++-4.9,clang++-3.6,clang++-20, etc.) to test compatibility, but theConfigurestep only setsCXX. With noCC, CMake's C compiler detection falls back to whatever default happens to be on the runner (as reported:clang++-3.6for C++, butGNU 11.4.0detected for C) — completely unrelated to the compiler version the job is actually meant to be testing.Fix
Add a small step before
Configurethat derivesCCfrom the samematrix.cxxvalue each job already installs a matching compiler for (clang++-N→clang-N,g++-N→gcc-N):Testing
This is a CI-config-only change, so the real test is the workflow run itself — I checked every distinct
matrix.cxxvalue used in this file (g++-4.9,g++-11,g++-13,g++-14,clang++-3.6,clang++-11,clang++-14,clang++-20) against the correspondinginstall/package steps in the same file to confirm a matchinggcc-N/clang-Nbinary is actually installed for each before relying on it (e.g. the "Install GCC 4.9" step explicitlydpkg -is agcc-4.9package, "Install Clang 3.6" explicitly installsclang-3.6, etc.) — the two entries without an explicit install step (g++-13/g++-14onubuntu-24.04, oneclang++-14variant) rely on the runner image's default toolchain, where the C and C++ drivers for the same version are always installed together. I also verified the string-substitution logic locally in bash against all 8 values (clang++-3.6correctly does not get double-substituted by theg++→gccreplacement, since theclang++→clangsubstitution runs first and already consumes the trailingg++substring), and validated the YAML withruby -ryaml. I can't run the actual matrix locally, so I'll be watching this PR's own CI run closely.