Summary
An xlings install hook that builds a package from source has no way to learn which C++ standard library the consumer will link against. For a package that ships static libraries, that makes a correct build impossible: std::__cxx11:: symbols cross the boundary, and a libc++ consumer fails at link.
Measured
mcpp-index's compat.mysql-connector-cpp builds MySQL Connector/C++ from source with CMake and the system compiler. On the index's linux llvm leg (clang + libc++):
ld.lld: error: undefined symbol: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::_M_create(unsigned long&, unsigned long)
ld.lld: error: undefined symbol: std::__throw_logic_error(char const*)
ld.lld: error: undefined symbol: vtable for std::__cxx11::basic_stringstream<...>
mysql-connector-cpp 386s FAIL
A probe was added to the install hook to log MCPP_CXX_STDLIB whatever its value (mcpplibs/mcpp-index#392). It reports:
11:46:18 MCPP_CXX_STDLIB=nil
Why, in this source tree
-
The only setter is the build-program path. src/build/build_program.cppm:
e.emplace_back("MCPP_CXX_STDLIB", env.cxxStdlib);
mcpp::cxx_stdlib() (src/build/hostprogram.cppm) reads it back. Both belong to a build program; an xlings install hook is not one.
-
The install call carries no toolchain. make_xlings_env returns an xlings::Env of {binary, home, projectDir}, and install_packages is invoked with XLINGS_HOME and PATH:
cd <home> && env -u XLINGS_PROJECT_DIR XLINGS_HOME=<home> xlings interface install_packages --args …
Nothing about the compiler, the toolchain, or the standard library crosses that boundary.
Why the existing workarounds do not reach
llamacpp refuses a libc++ toolchain by name with mcpp::cxx_stdlib() — but that lives in its build program, in its own repo. An inline descriptor has no such place.
[target.'cfg(...)'] self-gating has a platform axis and no standard-library axis. As src/pm/publisher.cppm puts it, a cfg selector is not a platform.
So a package in this position can neither adapt nor refuse. Today the index keeps the member off the llvm leg in CI, which is honest but is CI policy standing in for a missing capability.
What would close it
Any one of these; listed smallest first, no strong preference:
- Export
MCPP_CXX_STDLIB (and plausibly the compiler id) into the environment of install_packages, so an install hook can read what a build program reads.
- Pass the selected toolchain through
xlings::Env so xlings can hand it to hooks as first-class data rather than an environment variable.
- Give descriptors a way to declare an ABI requirement that mcpp checks before building, so the failure is a clear diagnostic at resolve time instead of a link error later.
(1) alone would let the descriptor in mcpplibs/mcpp-index#392 become a three-line change and let the CI entry come out.
Not urgent
The affected package is usable on every other leg, and the index documents the limitation where a user reads it. Filing so it is recorded rather than rediscovered.
Summary
An xlings install hook that builds a package from source has no way to learn which C++ standard library the consumer will link against. For a package that ships static libraries, that makes a correct build impossible:
std::__cxx11::symbols cross the boundary, and a libc++ consumer fails at link.Measured
mcpp-index'scompat.mysql-connector-cppbuilds MySQL Connector/C++ from source with CMake and the system compiler. On the index'slinux llvmleg (clang + libc++):A probe was added to the install hook to log
MCPP_CXX_STDLIBwhatever its value (mcpplibs/mcpp-index#392). It reports:Why, in this source tree
The only setter is the build-program path.
src/build/build_program.cppm:e.emplace_back("MCPP_CXX_STDLIB", env.cxxStdlib);mcpp::cxx_stdlib()(src/build/hostprogram.cppm) reads it back. Both belong to a build program; an xlings install hook is not one.The install call carries no toolchain.
make_xlings_envreturns anxlings::Envof{binary, home, projectDir}, andinstall_packagesis invoked withXLINGS_HOMEand PATH:Nothing about the compiler, the toolchain, or the standard library crosses that boundary.
Why the existing workarounds do not reach
llamacpprefuses a libc++ toolchain by name withmcpp::cxx_stdlib()— but that lives in its build program, in its own repo. An inline descriptor has no such place.[target.'cfg(...)']self-gating has a platform axis and no standard-library axis. Assrc/pm/publisher.cppmputs it, a cfg selector is not a platform.So a package in this position can neither adapt nor refuse. Today the index keeps the member off the llvm leg in CI, which is honest but is CI policy standing in for a missing capability.
What would close it
Any one of these; listed smallest first, no strong preference:
MCPP_CXX_STDLIB(and plausibly the compiler id) into the environment ofinstall_packages, so an install hook can read what a build program reads.xlings::Envso xlings can hand it to hooks as first-class data rather than an environment variable.(1) alone would let the descriptor in mcpplibs/mcpp-index#392 become a three-line change and let the CI entry come out.
Not urgent
The affected package is usable on every other leg, and the index documents the limitation where a user reads it. Filing so it is recorded rather than rediscovered.