Skip to content

Include <iomanip> directly for std::setw/setfill/setprecision (fixes build on libstdc++/Pi) - #782

Merged
jakmro merged 1 commit into
cactus-compute:mainfrom
nitishagar:fix/iomanip-direct-includes
Aug 13, 2026
Merged

Include <iomanip> directly for std::setw/setfill/setprecision (fixes build on libstdc++/Pi)#782
jakmro merged 1 commit into
cactus-compute:mainfrom
nitishagar:fix/iomanip-direct-includes

Conversation

@nitishagar

@nitishagar nitishagar commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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 uses std::setw / std::setfill / std::setprecision without 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 failure
  • cactus-engine/src/complete.cpp (was compiling only via a transitive include through utils.h)

Tests (were compiling only via their test_utils.h):

  • cactus-engine/tests/{test_llm,test_vlm,test_utils,test_embed,test_benchmark}.cpp
  • cactus-kernels/tests/{test_attention,test_matmul,test_conv,test_elementwise,test_reduce,test_quant,test_dsp}.cpp
  • cactus-graph/tests/test_nn.cpp

Files that already include <iomanip> directly (execute.cpp, the three test_utils.h, utils.h, …) are untouched.

Scope choice

The one-line fix to telemetry_impl.cpp alone unblocks the build; the other 14 files share the same latent defect (relying on a transitive include from utils.h / test_utils.h), so this makes each TU directly include what it uses. Happy to trim to just telemetry_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 at c90a1afa (this PR's base):

Local (macOS/clang/libc++): <iomanip> resolves std::setw/std::setfill/std::hex under -std=c++20 -Wall -Werror; <sstream> alone does not provide std::setw — the gap is real even on libc++, which is why macOS CI never caught it.

CI: the Build workflow (cactus-engine/** trigger) and DCO Check run on this PR.

DCO

This contribution complies with the Developer Certificate of Origin.

Signed-off-by: Nitish Agarwal 1592163+nitishagar@users.noreply.github.com

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>
@jakmro
jakmro merged commit ea7948c into cactus-compute:main Aug 13, 2026
6 checks passed
@jakmro

jakmro commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Thank you

@nitishagar
nitishagar deleted the fix/iomanip-direct-includes branch August 17, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails on libstdc++/GCC (e.g. Raspberry Pi aarch64): std::setw/setfill used without #include <iomanip>

2 participants