Skip to content

A host build ignores [target.<host triple>]: its cxx_runtime has no effect and no diagnostic says so #704

Description

@speak-agent

Observation

A host build does not read the [target.<triple>] section whose triple is the host's. The section's cxx_runtime has no effect, and the build does not report that it ignored the section.

Measured on 2026.9.26.1 and 2026.9.26.2, Linux x86_64, gcc@16.1.0:

[package]
name = "cxxrt"
version = "0.1.0"

[language]
standard = "c++23"
import_std = false

[target.x86_64-linux-gnu]
cxx_runtime = "toolchain-coupled"

[targets.cxxrt]
kind = "bin"
main = "src/main.cpp"
command NEEDED libstdc++.so.6
mcpp build absent (self-contained)
mcpp build --target x86_64-linux-gnu present
mcpp build with [build] cxx_runtime = "toolchain-coupled" present

src/build/prepare.cppm consults targetOverrides only when overrides.target_triple is set (--target, [build] target, or a configured default target). The warning for [target.'cfg(linux)'.build] cxx_runtime directs the user to [target.<triple>].cxx_runtime, which a host build then ignores.

Consequence

A program that links Qt's official Linux libraries embeds libstdc++, and each Qt library requires libstdc++.so.6. QtCore carries RUNPATH $ORIGIN, so the loader does not search the executable's RPATH for QtCore's dependencies, and the program fails at start with libstdc++.so.6: cannot open shared object file. The engine's interposition check reports the embedded copy: 72 symbols are also provided by the toolchain's libstdc++.so.6. mcpp-plugins 0.13.0 (rules-qt) states the contract in [build] for this reason.

Proposed behaviour

  1. A host build resolves the host triple and applies the matching [target.<triple>] section, using the same spelling-independent comparison as --target. The remaining keys of that section already describe the host target in every other respect.
  2. Alternatively, the build reports a [target.<triple>] section whose triple is the host's and which the build did not read.

A further generalisation would extend the 2026.9.16.1 rule, under which an ELF program whose contract nobody stated adopts the contract of a C++ shared library that the build makes. The same rule would apply to a prebuilt shared library in the link that has NEEDED libstdc++.so.6. Qt users would then state nothing.

Activity

  1. speak-agent commented on Sep 27, 2026

    @speak-agent
    MemberAuthor

    Reopened: the merge commit of #719 closed this through a keyword in its message, before the release is verified. It is closed again, with the verification, after mcpp 2026.9.27.1 is checked in an xlings subos sandbox.

  2. speak-agent commented on Sep 27, 2026

    @speak-agent
    MemberAuthor

    Fixed in mcpp 2026.9.27.1 (#719, merged as b439fd9), released on GitHub and mirrored to GitCode (xlings-res/mcpp), and published in the xim index (openxlings/xim-pkgindex#894).

    Verified after the release with the published binary inside an xlings subos sandbox (xlings subos use eco-0927 --sandbox --cmd ...), mcpp configured for the CN mirror in a fresh MCPP_HOME:

    • e2e 802_a_host_build_applies_its_host_row: without the row a plain build is self-contained; with [target.<host>] cxx_runtime = "toolchain-coupled" a plain mcpp build needs libstdc++.so.6, as --target <host> does; the row is also found under the four-segment spelling of the host triple. PASS.
    • mcpp:plugins 0.16.0 moves its Qt fixtures' Linux C++ runtime into the host rows on the strength of this.
  3. added a commit that references this issue on Oct 3, 2026
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