Skip to content

Commit 9babf50

Browse files
committed
fix: CapabilityProvider aggregate instead of std::pair (musl modules link)
The release (musl-gcc 15.1 static) link failed with an undefined reference to vector<pair<string,string>>'s move ctor from the BuildPlan move ctor — the instantiation wasn't emitted across the module boundary on that toolchain. Use a named aggregate (capability, provider); structured bindings unchanged. Verified: glibc build + musl-static self-build (the exact release path) link.
1 parent bd6c695 commit 9babf50

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/build/plan.cppm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,14 @@ struct BuildPlan {
6666
// in mcpp: providers (e.g. compat.glx-runtime) declare these per platform.
6767
std::vector<std::string> runtimeDlopenLibs; // union of deps' dlopen sonames
6868
std::vector<std::string> runtimeCapabilities; // union of host capabilities
69-
std::vector<std::pair<std::string, std::string>> runtimeProviders; // (capability, provider pkg)
69+
// (capability, provider package). A named aggregate instead of std::pair:
70+
// musl-gcc 15.1 modules failed to emit vector<pair<string,string>>'s
71+
// move-ctor instantiation across the module boundary (release link error).
72+
struct CapabilityProvider {
73+
std::string capability;
74+
std::string provider;
75+
};
76+
std::vector<CapabilityProvider> runtimeProviders;
7077
};
7178

7279
// Build a BuildPlan from already-validated inputs.
@@ -241,7 +248,7 @@ BuildPlan make_plan(const mcpp::manifest::Manifest& manifest,
241248
for (auto const& cap : package.manifest.runtimeConfig.capabilities) {
242249
if (std::ranges::find(plan.runtimeCapabilities, cap) == plan.runtimeCapabilities.end())
243250
plan.runtimeCapabilities.push_back(cap);
244-
plan.runtimeProviders.emplace_back(cap, package.manifest.package.name);
251+
plan.runtimeProviders.push_back({cap, package.manifest.package.name});
245252
}
246253
}
247254
// The same private runtime directories embedded as executable RUNPATH are

src/cli.cppm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,8 +3298,8 @@ prepare_build(bool print_fingerprint,
32983298
bool found = false;
32993299
std::stable_partition(ctx.plan.runtimeProviders.begin(),
33003300
ctx.plan.runtimeProviders.end(),
3301-
[&](const std::pair<std::string, std::string>& pr) {
3302-
bool match = pr.first.rfind(capKey, 0) == 0 && pr.second == prov;
3301+
[&](const auto& pr) {
3302+
bool match = pr.capability.rfind(capKey, 0) == 0 && pr.provider == prov;
33033303
found = found || match;
33043304
return match;
33053305
});

0 commit comments

Comments
 (0)