Include <iomanip> directly for std::setw/setfill/setprecision (fixes build on libstdc++/Pi) - #782
Merged
jakmro merged 1 commit intoAug 13, 2026
Conversation
The native engine build (cactus build --python) fails on strict libstdc++ (e.g. Raspberry Pi GCC) with "'setw' is not a member of 'std'" in cactus-engine/src/telemetry_impl.cpp, which uses std::setw/std::setfill without including <iomanip>. Add a direct #include <iomanip> to every translation unit that uses std::setw/std::setfill/std::setprecision without one: 2 production sources (telemetry_impl.cpp, complete.cpp) and 13 tests. Several compiled only via a transitive include through utils.h / test_utils.h, which is non-portable across libstdc++/libc++ and fragile to header changes; telemetry_impl.cpp had no such transitive path and failed outright. No behavioral change; headers only. Signed-off-by: Nitish Agarwal <1592163+nitishagar@users.noreply.github.com>
Collaborator
|
Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #783 — see the issue for the problem, the full error, root cause, and scope analysis.
Summary
Adds a direct
#include <iomanip>to every translation unit that usesstd::setw/std::setfill/std::setprecisionwithout one. Headers only — no behavioral change. One line per file; diff is +15 / −0.Changes
Production sources (compiled into
cactus_engine):cactus-engine/src/telemetry_impl.cpp← the actual build failurecactus-engine/src/complete.cpp(was compiling only via a transitive include throughutils.h)Tests (were compiling only via their
test_utils.h):cactus-engine/tests/{test_llm,test_vlm,test_utils,test_embed,test_benchmark}.cppcactus-kernels/tests/{test_attention,test_matmul,test_conv,test_elementwise,test_reduce,test_quant,test_dsp}.cppcactus-graph/tests/test_nn.cppFiles that already include
<iomanip>directly (execute.cpp, the threetest_utils.h,utils.h, …) are untouched.Scope choice
The one-line fix to
telemetry_impl.cppalone unblocks the build; the other 14 files share the same latent defect (relying on a transitive include fromutils.h/test_utils.h), so this makes each TU directly include what it uses. Happy to trim to justtelemetry_impl.cpp(or the two production sources) if a tighter scope is preferred.Validation
On the reported environment — Raspberry Pi (
aarch64), GCC 12.2.0 / libstdc++ (Debian 12), upstream tree atc90a1afa(this PR's base):#include <sstream>+std::setw/std::setfill→g++ -std=c++20fails with'setw' is not a member of 'std'(reproduces Build fails on libstdc++/GCC (e.g. Raspberry Pi aarch64): std::setw/setfill used without #include <iomanip> #783 on the exact toolchain).#include <iomanip>→ compiles and links clean (exit 0).Local (macOS/clang/libc++):
<iomanip>resolvesstd::setw/std::setfill/std::hexunder-std=c++20 -Wall -Werror;<sstream>alone does not providestd::setw— the gap is real even on libc++, which is why macOS CI never caught it.CI: the
Buildworkflow (cactus-engine/**trigger) andDCO Checkrun on this PR.DCO
This contribution complies with the Developer Certificate of Origin.
Signed-off-by: Nitish Agarwal 1592163+nitishagar@users.noreply.github.com