Skip to content

Commit c8ac60a

Browse files
committed
fix(pack): print the compiler's output when the packer's build fails
Windows CI reported error: build failed FAIL: shared pack failed off ELF and nothing else, because `mcpp pack` printed `BuildError::message` and dropped `BuildError::diagnosticOutput` — the field that carries what the compiler actually said. `mcpp build` has printed it all along; the two pack pipelines were the only callers that did not. That is a defect on its own terms, not just an inconvenience for this investigation: a packaging failure is exactly when a maintainer has least context, and three words is not a report. Both pipelines now print it.
1 parent bbf785e commit c8ac60a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/pack/library_pipeline.cppm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
//
1515
// Design: .agents/docs/2026-08-17-library-distribution-design.md §2.
1616

17+
module;
18+
// `stderr` / `fputs`: the packer prints the compiler's own diagnostics, and a
19+
// build failure that arrives as three words is a build failure nobody can act
20+
// on. This global module fragment was removed once as an unused `<cstdio>`;
21+
// it has a use now.
22+
#include <cstdio>
23+
1724
export module mcpp.pack.library_pipeline;
1825

1926
import std;
@@ -158,6 +165,14 @@ export int build_and_pack_library(const std::string& targetName,
158165
auto be = mcpp::build::make_ninja_backend();
159166
mcpp::build::BuildOptions bo;
160167
if (auto br = be->build(ctx->plan, bo); !br) {
168+
// The compiler's own output, not just "build failed". `mcpp build`
169+
// has always printed this; `mcpp pack` dropped it, so a failure
170+
// inside the packer's build arrived as three words and CI logs had
171+
// nothing to go on.
172+
if (!br.error().diagnosticOutput.empty()) {
173+
std::fputs(br.error().diagnosticOutput.c_str(), stderr);
174+
if (br.error().diagnosticOutput.back() != '\n') std::fputs("\n", stderr);
175+
}
161176
mcpp::ui::error(br.error().message);
162177
return 1;
163178
}

src/pack/pipeline.cppm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ export int build_and_pack(Options opts, bool modeFromUser,
8686
mcpp::build::BuildOptions bo;
8787
auto br = be->build(ctx->plan, bo);
8888
if (!br) {
89+
// The compiler's own output, not just "build failed" — same reason as
90+
// in the library pipeline.
91+
if (!br.error().diagnosticOutput.empty()) {
92+
std::fputs(br.error().diagnosticOutput.c_str(), stderr);
93+
if (br.error().diagnosticOutput.back() != '\n') std::fputs("\n", stderr);
94+
}
8995
mcpp::ui::error(br.error().message);
9096
return 1;
9197
}

0 commit comments

Comments
 (0)