Skip to content

fix(mysql-connector-cpp): state the C++ standard library as a layer requirement - #399

Merged
Sunrisepeak merged 2 commits into
mainfrom
fix/mysql-connector-cpp-requires-cxx-abi
Sep 11, 2026
Merged

fix(mysql-connector-cpp): state the C++ standard library as a layer requirement#399
Sunrisepeak merged 2 commits into
mainfrom
fix/mysql-connector-cpp-requires-cxx-abi

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Sep 11, 2026

Copy link
Copy Markdown
Member

compat.mysql-connector-cpp builds static libraries with CMake and each platform's system compiler: g++ with libstdc++ on Linux, Apple clang with libc++ on macOS. On Linux, a consumer whose toolchain links libc++ failed at link:

ld.lld: error: undefined symbol: std::__cxx11::basic_string<...>::_M_create(...)

The index CI keeps this member off the llvm leg for that reason. The skip's comment deferred to mcpp-community/mcpp#613, on the expectation that the install hook would one day see the consumer's standard library.

What mcpp#613 established

The hook cannot see it, and not for lack of a variable. mcpp resolves the toolchain after the dependency graph, because a package in the graph may supply a target-side layer. When a dependency's install hook runs, no standard library has been decided yet.

mcpp 2026.9.12.2 emits MCPP_CXX_STDLIB to install hooks, and it is empty there. mcpp's tests/e2e/648 measures this.

The requirement is therefore stated in the descriptor, with the layer grammar mcpp already enforces.

Change

  • The descriptor states the requirement in its per-platform tables, which the reader splices into the mcpp segment for the target platform: requires = { "mcpp:c++-abi=libstdc++" } under linux, and requires = { "mcpp:c++-abi=libc++" } under macosx. A consumer whose toolchain resolves the other implementation is refused at resolution, naming both, instead of failing at link.
  • The first revision stated libstdc++ for every platform, and the macOS default leg of this PR's CI refused the member, which builds and links there. That leg is the measurement for the macosx entry.
  • The comment in install() states why the hook cannot adapt. The probe's expected value becomes "nil or empty".
  • The llvm-leg skip in validate.yml stays, with the reason updated. The refusal follows the hook's source build (about 881 s), so the leg would spend the build to reach a known refusal.

Measurements

The descriptor form of the requirement, scoped the same way (linux = { requires = ... }, macosx = { requires = ... }), was measured with mcpp 2026.9.12.2 on a local index package that has no download:

$ mcpp build --toolchain llvm@22.1.8      # exit 2
error: `stdreqp@1.0.0` requires the c++-abi to be `libstdc++`.
         c++-abi           libc++         (payload)
         required          libstdc++      (required by stdreqp@1.0.0)

$ mcpp build                              # gcc@16.1.0, exit 0

Compatibility with the index floor (min_mcpp = 2026.8.27.2):

  • Before 2026.8.29.1: descriptor requires is not read. That reader records the key as unknown and prints a warning (warn_unknown_xpkg_keys), then proceeds as before, so the descriptor does not raise the floor.
  • From 2026.8.29.1: the key and the c++-abi layer are read and enforced.

The lint loop from validate.yml passes locally on the file (Lua syntax, mirror URLs, package name), and mcpp xpkg parse --all-os, which refuses unknown keys, accepts both the linux and the macosx sections.

…equirement

The install hook cannot see the consumer's standard library: mcpp resolves the toolchain after the dependency graph, so none exists when a dependency installs (mcpp-community/mcpp#613). The descriptor now declares requires = { "mcpp:c++-abi=libstdc++" }, so a libc++ consumer is refused at resolution naming both implementations instead of failing at link. The llvm-leg skip stays with its reason updated.
…ch platform's system compiler

The macOS default leg refused the member: install() builds with Apple clang there, so the static libraries are libc++ and the default toolchain's libc++ is the matching one. The requirement moves into the per-platform tables: libstdc++ under linux, libc++ under macosx. Measured locally: a linux-scoped requirement is refused under llvm naming both implementations and satisfied by gcc; mcpp xpkg parse --all-os accepts both sections.
@Sunrisepeak
Sunrisepeak merged commit 8963c6f into main Sep 11, 2026
14 checks 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