Reproduction
On a fresh Ubuntu 24.04 ARM64 host, mcpp selects gcc@15.1.0-musl as the native toolchain. A project containing even this minimal build program fails:
#include <cstdio>
int main() {
std::puts("build helper ran");
return 0;
}
build.mcpp compiling
build.mcpp running
build.mcpp exited with 127
readelf shows target/.build-mcpp/build.mcpp.bin is dynamically linked with interpreter /lib/ld-musl-aarch64.so.1. The glibc Ubuntu host does not provide that loader, and strace reports execve(.../build.mcpp.bin, ...) = -1 ENOENT.
Root cause
prepare.cppm correctly defaults musl project output to static linkage, but build_program.cppm constructs the host-helper link command independently and does not add -static. process.cppm then collapses the posix_spawnp error into exit 127 with empty output.
Expected behavior
- A build program compiled with a musl host toolchain is fully static and runs without a host musl loader.
- A
posix_spawnp failure retains a useful error message instead of returning an unexplained empty exit 127.
Proposed fix
- Add
-static only to the final build.mcpp helper link when the resolved host toolchain targets musl.
- Rev the build-program cache identity so older helper-link policy caches are invalidated.
- Preserve the direct
posix_spawnp error code and message in captured output.
- Add native Ubuntu ARM64 fresh-install coverage that runs a minimal
build.mcpp and asserts the helper has no PT_INTERP.
Environment
- mcpp: 0.0.109
- Host: Ubuntu 24.04 ARM64 (glibc)
- Toolchain selected by mcpp: gcc@15.1.0-musl
Reproduction
On a fresh Ubuntu 24.04 ARM64 host, mcpp selects
gcc@15.1.0-muslas the native toolchain. A project containing even this minimal build program fails:readelfshowstarget/.build-mcpp/build.mcpp.binis dynamically linked with interpreter/lib/ld-musl-aarch64.so.1. The glibc Ubuntu host does not provide that loader, andstracereportsexecve(.../build.mcpp.bin, ...) = -1 ENOENT.Root cause
prepare.cppmcorrectly defaults musl project output to static linkage, butbuild_program.cppmconstructs the host-helper link command independently and does not add-static.process.cppmthen collapses theposix_spawnperror into exit 127 with empty output.Expected behavior
posix_spawnpfailure retains a useful error message instead of returning an unexplained empty exit 127.Proposed fix
-staticonly to the finalbuild.mcpphelper link when the resolved host toolchain targets musl.posix_spawnperror code and message in captured output.build.mcppand asserts the helper has noPT_INTERP.Environment