You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
toolchain: the target's convention pin silently overrides an explicitly-set default toolchain, and toolchain list still reports the ignored one #283
Reproduced on 0.0.107 with ~/.mcpp/config.toml holding [toolchain] default = "gcc@15.1.0", default_target = "x86_64-linux-musl", and both musl-gcc 15.1.0 and 16.1.0 installed.
Cause
Once the target triple is known, the vocabulary tables convention pin replaces whatever tcSpec held — src/build/prepare.cppm:894:
if (known && !hasToolchainOverride && !known->pin.empty())
tcSpec = std::string(known->pin);
x86_64-linux-musl is pinned to gcc@16.1.0 (src/toolchain/triple.cppm:104), and hasToolchainOverride (prepare.cppm:854) is true only for a [target.X] toolchain = ... section in the projects mcpp.toml:
The global config is not consulted — and the global config is exactly what mcpp toolchain default writes (lifecycle.cppm:690). So a users explicit choice never counts as an override and the pin always wins.
mcpp toolchain list reads the config directly instead (effective_default_toolchain, lifecycle.cppm:198/223), which is why it shows the value the build just discarded. Two code paths, two different notions of "the default".
Why it matters
The pin itself is well-founded — the comment in triple.cppm records that GCC 15 drops module template instantiations at link under musl — so silently preferring 16 is defensible. What is not defensible is doing it without a word while toolchain list presents the ignored setting as the default. A user has no way to tell the setting did not take, and --print-fingerprint / mcpp explain toolchain are not where they would look after running an explicit toolchain default.
Note the pins own comment (triple.cppm:93-95) scopes it to "--target <canonical> with no explicit ... override". Someone who ran mcpp toolchain default gcc 15 --target x86_64-linux-musl has made an explicit choice; the code just does not recognise that spelling of it.
Let an explicitly-set global default carry the same weight as [target.X] toolchain — the user asked for it by name, including the target.
If the pin must still win (module-linking correctness is a real constraint), say so at resolve time: note: x86_64-linux-musl pins gcc@16.1.0; your default gcc@15.1.0 was not used — and have toolchain list mark the pinned value as what will actually run.
Either way the two paths should share one resolution function, so list and build cannot drift again.
Closing: the row's toolchain stays the choice, and it is no longer silent.
A global default does not outrank a row's pin. The reason is recorded in the source as a measured regression: the pin names the payload that supplies the target's C library.
The Resolved line says so: target default for <triple>, replacing your <default> — override with [target.<triple>] toolchain.
mcpp toolchain list lists each target with the toolchain it builds with.
Read from source at 2026.11.26.1 (src/build/prepare/toolchain_resolver.cpp); the home of the report was not rebuilt.
Activity
speak-agent commentedon Nov 26, 2026
Closing: the row's toolchain stays the choice, and it is no longer silent.
Resolvedline says so:target default for <triple>, replacing your <default> — override with [target.<triple>] toolchain.mcpp toolchain listlists each target with the toolchain it builds with.Read from source at 2026.11.26.1 (
src/build/prepare/toolchain_resolver.cpp); the home of the report was not rebuilt.