skip to content

After a developer bumps compiler.version in the shared Conan 2 CI profile, every compiled dependency rebuilds from source. Why, and how do you confirm and contain it?

level: seniorimportance: should knowfreq 45%

answer

  1. compiler.version is a setting
  2. every package_id changes
  3. default compatibility covers cppstd only
  4. graph explain shows the diff

basics

~20 s

compiler.version is a setting, so every compiled package gets a new package_id with no binary on the remote, and --build=missing builds them all. conan graph explain shows the diff; contain it by prebuilding and uploading once, or by an explicit compatibility rule.

solid answer

~50 s

Every recipe that declares `compiler` hashes `compiler.version` into its `package_id`, so changing it in the profile asks for a brand-new set of binaries. The team remote only holds the old IDs, and the default compatibility plugin only falls back across `compiler.cppstd` (plus `compiler.cstd` and MSVC 194 to 193), not across GCC or Clang versions, so with `--build=missing` CI compiles the whole graph. Header-only packages are untouched because their info is cleared. Confirm with `conan graph explain`, which prints the closest existing binary and a diff such as `expected: compiler.version=17, existing: compiler.version=21`. Then decide: if the bump is intended, run one package-producing job with `--build=missing` and `conan upload` the new binaries so other jobs download them; if not, revert the profile. Only if the team accepts the ABI risk should it add a `compiler.version` fallback to `compatibility.py`.

code

console · 13 lines
console
$ conan graph explain . -s compiler.version=17
...
======== Closest binaries ========
fmt/11.0.2
  fmt/11.0.2#f84efa4e...:b8da0684...
    remote: Local Cache
    settings: Macos, armv8, Release, apple-clang, gnu17, libc++, 21
    options: fPIC=True, shared=False
    diff
      settings
        expected: compiler.version=17
        existing: compiler.version=21
      explanation: This binary was built with different settings.

go deeper

for a junior

Know that compiler.version is a setting and that settings feed the package_id, so a new version means new binaries.

for a middle

Explain the compatibility plugin's defaults and why cppstd changes reuse binaries while compiler.version changes do not.

for a senior

Confirm with conan graph explain and profile diffs, then prebuild and upload once and run consumers without --build.

for a principal

Decide whether compiler-version fallbacks are acceptable for your binaries, and who approves profile changes that invalidate the remote.

## The symptom A pipeline that normally finishes in minutes suddenly spends an hour compiling Boost, OpenSSL and everything else, and the only change in the commit is one line in the shared CI profile: `compiler.version=13` became `compiler.version=14`. Nothing in the recipes changed, and the remote still holds all the binaries from yesterday. ## Why every package rebuilds The **package_id** of a Conan 2 package is a hash of its info object: the declared **settings**, the **options**, and the **requirements** reduced by the package ID modes. Almost every compiled recipe declares `settings = "os", "compiler", "build_type", "arch"`, and `compiler.version` is a sub-setting of `compiler`. Changing it therefore changes the ID of every compiled package in the graph, and because consumers' IDs include their dependencies according to the package ID modes, the change is not limited to leaves. The remote is searched for the **new** IDs, finds nothing, and the next step is compatibility. ## What compatibility does and does not cover When the exact ID is missing, Conan 2 asks the `compatibility.py` plugin in the Conan home, plus any `compatibility()` method in the recipe, for alternative configurations to try. The plugin shipped with Conan 2.33: - tries every other supported `compiler.cppstd` value, and `compiler.cstd` likewise; - for `msvc`, falls back from compiler version 194 to 193; - does **not** try other `compiler.version` values for gcc, clang or apple-clang. So `-s compiler.cppstd=20` against a gnu17 binary finds a compatible package, while a `compiler.version` change on GCC or Clang does not. With `--build=missing` in the pipeline, every package falls through to a source build. Packages with `package_type = "header-library"` are the exception: their info is cleared, so one binary serves every compiler. ## Confirming the cause 1. **Read the install output.** Every compiled dependency shows `Missing` or, with `--build=missing`, `Build`, and the printed configuration contains the new `compiler.version`. 2. **Run `conan graph explain`** with the same arguments. It lists the closest binaries it can find and a diff, for example `expected: compiler.version=17` against `existing: compiler.version=21`, with the explanation that the binary was built with different settings. 3. **Diff the effective profiles** with `conan profile show` on the old and new commit, which also catches changes that came in through an `include()` or a Jinja expression. 4. **List what the remote has** with `conan list "zlib/1.3.1:*" -r <remote>`, whose output shows each package ID with its settings. ## Containing it The right response depends on whether the bump was intended. - **Unintended**: revert the profile line, and protect the profiles with code review, for example by distributing them with `conan config install` from a reviewed repository. - **Intended upgrade**: accept that the binaries must exist once. Run a single package-producing job with `--build=missing`, `conan upload` the new binaries to the team remote, and let every other pipeline download them. Consumer pipelines can run without `--build`, so they fail fast instead of each rebuilding the world. - **Believed ABI-compatible**: a team can add a factor such as `compiler.version` fallbacks to its own `compatibility.py`, or a `compatibility()` method to selected recipes. On a test run, a rule mapping apple-clang 17 to 21 made Conan report `Found compatible package ... compiler.version=21`. This trades rebuild time for the risk of mixing binaries from different compilers, which is an ABI judgment, not a Conan one. Remove the generated-by-Conan comment at the top of the file, or Conan restores the default on upgrade. ## What not to do - Do not "fix" it with `--build="*"`; that only makes every future run rebuild too. - Do not delete `compiler` from `package_id()` in your own recipes to silence the rebuild; that hides real incompatibilities from everyone. - Do not let detection decide: a runner image that changes its compiler under `conan profile detect` produces the same storm without anyone editing a profile.

  • Why does a cppstd change not trigger the same rebuild storm?
    The default `compatibility.py` offers every other supported `compiler.cppstd` value as a fallback. Conan finds the existing binary built with another standard and reports `Found compatible package`, so nothing is rebuilt.
  • How would you stop consumer pipelines from rebuilding while the new binaries are being produced?
    Run them without `--build`, so a missing binary is an error with a clear message, and let one package-producing job run `--build=missing` and upload. The consumers go green as soon as the remote has the new IDs.

  • Conan rebuilt because the recipes' revisions changed.
  • The default compatibility plugin falls back across GCC and Clang compiler versions.
  • --build="*" is the fix for a cache that no longer matches the profile.
  • Header-only packages also need rebuilding after a compiler bump.
  • Deleting compiler from package_id() in every recipe is a safe way to stop rebuilds.