Skip to content

fix(pm): de-inline resolver functions to satisfy musl-gcc 15.1 link#12

Merged
Sunrisepeak merged 2 commits intomainfrom
ci/release-resolver-link-fix
May 8, 2026
Merged

fix(pm): de-inline resolver functions to satisfy musl-gcc 15.1 link#12
Sunrisepeak merged 2 commits intomainfrom
ci/release-resolver-link-fix

Conversation

@Sunrisepeak
Copy link
Copy Markdown
Member

Summary

The release.yml musl-static build of v0.0.2 failed at the link step:

obj/cli.m.o: in function `std::_Vector_base<mcpp::version_req::Version>::~_Vector_base()':
  undefined reference to `std::_Vector_base<...>::_Vector_impl::~_Vector_impl()'

PR-R4 declared resolve_semver and friends inline in
pm/resolver.cppm. Every importer (currently cli.cppm) ends up
locally instantiating the destructor of std::_Vector_base<vr::Version>.
With musl-gcc 15.1's libstdc++ that specific instantiation is missing
the matching _Vector_impl destructor symbol, and the linker rejects.

Moving the function bodies out of the export block — declarations
only there, definitions in a later non-export mcpp::pm block within
the same module unit — gives a single definition point, single
instantiation site. The cross-module duplicate disappears and musl-gcc
links cleanly.

ci.yml never caught this because it uses gcc@16.1.0 (glibc); the issue
is specific to musl-gcc 15.1's libstdc++.

Verification

  • mcpp build — glibc, 9/9 unit tests pass
  • mcpp build --target x86_64-linux-musl — musl-gcc 15.1, links clean
  • CI green
  • Re-run release.yml with tag=v0.0.2 after this lands

The push-tag trigger that fired for v0.0.2 failed with

  Cannot fetch both ef6dffd... and refs/tags/v0.0.2 to refs/tags/v0.0.2

— a known interaction in actions/checkout@v4 where `fetch-tags: true`
combined with a tag ref tries to fetch the same ref twice. Switching to
`fetch-depth: 0` gives the resolve-tag step the full history it needs
without the duplicate-fetch conflict.

(The release.yml flow itself is unchanged; this only fixes the runner
side.)
The release.yml musl-static build of v0.0.2 failed at the link step:

  obj/cli.m.o: in function `std::_Vector_base<mcpp::version_req::Version>::~_Vector_base()':
    undefined reference to `std::_Vector_base<...>::_Vector_impl::~_Vector_impl()'

`pm/resolver.cppm` declared `resolve_semver` `inline`, so every importer
(currently `cli.cppm`) wound up locally instantiating the destructor of
`std::_Vector_base<vr::Version>`. With musl-gcc 15.1's libstdc++ that
specific instantiation is missing the corresponding `_Vector_impl`
destructor symbol, and the linker rejects.

Move the function bodies out of the `export` block in `pm/resolver.cppm`
(declarations only there, definitions in a non-export `mcpp::pm` block
later in the same module unit). Single definition point, single
instantiation site — the cross-module duplicate goes away and musl-gcc
links cleanly.

Reproduced and verified locally with `mcpp build --target x86_64-linux-musl`
on the same musl-gcc 15.1 toolchain CI uses.

`mcpp build` (glibc) + `mcpp test` (9/9 unit) still pass.
@Sunrisepeak Sunrisepeak merged commit ba5f1a6 into main May 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant