Skip to content

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

Description

@nitishagar

Summary

cactus build --python fails to compile the native engine on libstdc++ (e.g. Raspberry Pi) because cactus-engine/src/telemetry_impl.cpp uses std::setw / std::setfill without including <iomanip>. The same latent defect exists in 14 other translation units that currently compile only via a transitive include.

Environment

  • Board: Raspberry Pi (aarch64-linux-gnu)
  • Toolchain: GCC 12.2.0 (Debian 12.2.0-14+deb12u1), libstdc++, glibc 2.36 (Debian 12 bookworm)
  • Tree: upstream cactus main @ c90a1afa

Error

cactus-engine/src/telemetry_impl.cpp:689:24: error: 'setw' is not a member of 'std'
  689 |     oss << "-" << std::setw(4) << ((a >> 16) & 0xffffULL);
      |                        ^~~~
... repeats for each std::setw / std::setfill use (lines 666-671 and 687-692)
make[2]: *** [CMakeFiles/cactus_engine.dir/build.make:228: CMakeFiles/cactus_engine.dir/src/telemetry_impl.cpp.o] Error 1
Building Cactus for Python... Build failed

Root cause

telemetry_impl.cpp uses std::hex / std::setfill / std::setw (lines 666-671, 687-692) but does not include <iomanip>, and none of its headers pulls it in transitively — it does not include utils.h, the project header that provides <iomanip> elsewhere in the engine. On libc++ (macOS/clang) the symbols are reachable through other standard headers, so macOS CI passed; on libstdc++ (Pi GCC 12.2, aarch64) they are not, and the build breaks.

Scope

  • Actually broken (reported failure): cactus-engine/src/telemetry_impl.cpp — no transitive <iomanip> path.
  • Latent (compile today only via a transitive include from utils.h / test_utils.h): cactus-engine/src/complete.cpp plus 13 test TUs (cactus-engine/tests/*, cactus-kernels/tests/*, cactus-graph/tests/test_nn.cpp). Same non-portable reliance.
  • Both telemetry_impl.cpp and complete.cpp are compiled into the cactus_engine static-lib target (cactus-engine/CMakeLists.txt, ENGINE_SOURCES).

Reproduction (on the failing toolchain)

#include <sstream>
int main(){ std::ostringstream o; o << std::setw(8) << 42u; }

g++ -std=c++20 repro.cpperror: 'setw' is not a member of 'std'. Adding #include <iomanip> compiles clean. Verified on the Pi's GCC 12.2.0 / libstdc++ / aarch64.

Proposed fix

Add a direct #include <iomanip> to each affected translation unit. See #782.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions