Skip to content

Commit 04503f1

Browse files
committed
fix(mysql-connector-cpp): the standard library requirement follows each 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.
1 parent 78e6f47 commit 04503f1

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

.github/workflows/validate.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,11 @@ jobs:
12111211
# yet when the hook runs, and MCPP_CXX_STDLIB is nil (older mcpp) or
12121212
# empty (2026.9.12.2 and later) there (#392; mcpp-community/mcpp#613,
12131213
# measured by its tests/e2e/648). The descriptor states the
1214-
# requirement instead, `requires = { "mcpp:c++-abi=libstdc++" }`, and a
1215-
# libc++ consumer is refused at resolution naming both implementations.
1214+
# requirement instead, `requires = { "mcpp:c++-abi=libstdc++" }` in its
1215+
# `linux` table, and a libc++ consumer is refused at resolution naming
1216+
# both implementations. (On macOS the libraries are built with Apple
1217+
# clang, and the `macosx` table requires libc++, which the default
1218+
# toolchain there resolves.)
12161219
# That refusal follows the hook's source build, so the member stays off
12171220
# this leg: the leg would spend the build to reach a known refusal.
12181221
#

pkgs/c/compat.mysql-connector-cpp.lua

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,27 @@ package = {
4646
sources = { "mcpp_mysql_connector_cpp_anchor.c" },
4747
include_dirs = { "include" },
4848
targets = { ["mysql_connector_cpp"] = { kind = "lib" } },
49-
-- The static libraries are compiled against libstdc++ (see the comment
50-
-- in install()), so a consumer whose toolchain resolves another C++
51-
-- standard library is refused at resolution, naming both, instead of
52-
-- failing at link. An mcpp older than the layer grammar reports this
53-
-- key as unknown and proceeds as before.
54-
requires = { "mcpp:c++-abi=libstdc++" },
5549
deps = {
5650
["compat.libmysqlclient"] = "8.4.6",
5751
["compat.openssl"] = "3.5.1",
5852
},
5953

54+
-- THE STANDARD LIBRARY THE STATIC LIBRARIES WERE COMPILED AGAINST, per
55+
-- platform, because install() uses each platform's system compiler:
56+
-- g++ with libstdc++ on Linux, Apple clang with libc++ on macOS. A
57+
-- consumer whose toolchain resolves the other one is refused at
58+
-- resolution, naming both, instead of failing at link. An mcpp older
59+
-- than the layer grammar reports the key as unknown and proceeds as
60+
-- before.
6061
linux = {
62+
requires = { "mcpp:c++-abi=libstdc++" },
6163
ldflags = {
6264
"-Llib", "-l:libmysqlcppconnx-static.a",
6365
"-l:libmysqlcppconn-static.a", "-lresolv",
6466
},
6567
},
6668
macosx = {
69+
requires = { "mcpp:c++-abi=libc++" },
6770
ldflags = {
6871
"-Llib", "-lmysqlcppconnx-static",
6972
"-lmysqlcppconn-static", "-lresolv",
@@ -273,8 +276,8 @@ function install()
273276

274277
-- THE STANDARD LIBRARY THIS IS BUILT AGAINST HAS TO MATCH THE CONSUMER'S.
275278
--
276-
-- CMake picks the system compiler below, so the static libs come out
277-
-- against libstdc++ whatever the consumer uses. On the llvm leg, which
279+
-- CMake picks the system compiler below, so on Linux the static libs come
280+
-- out against libstdc++ whatever the consumer uses. On the llvm leg, which
278281
-- links libc++, the member then fails at link with the libstdc++ half of
279282
-- its own dependency undefined:
280283
--
@@ -306,7 +309,8 @@ function install()
306309
-- with the system compiler, so `std::__cxx11::` and friends cross the
307310
-- boundary into the consumer. Consuming them from a libc++ toolchain does
308311
-- not work and cannot be made to work from inside this hook. The
309-
-- descriptor states it instead (`requires` in the mcpp table above), and
312+
-- descriptor states it instead (`requires` in the per-platform tables of
313+
-- the mcpp segment above), and
310314
-- `validate.yml` keeps this member off the llvm leg, because the refusal
311315
-- follows this hook's source build and the leg would spend the build to
312316
-- reach an answer it already knows.

0 commit comments

Comments
 (0)