Skip to content

Add missing <cstdint> include in ClockDelta.h for GCC 15#9

Open
wreiske wants to merge 1 commit into
OpenMoonRay:mainfrom
wreiske:fix/clockdelta-cstdint-gcc15
Open

Add missing <cstdint> include in ClockDelta.h for GCC 15#9
wreiske wants to merge 1 commit into
OpenMoonRay:mainfrom
wreiske:fix/clockdelta-cstdint-gcc15

Conversation

@wreiske
Copy link
Copy Markdown

@wreiske wreiske commented May 23, 2026

Summary

ClockDelta.h uses uint64_t in the declaration of analyzeRoundTripTimeDelta() (lines 60–62) but does not include <cstdint>. This previously compiled because older libstdc++ leaked the definition transitively via other standard headers. GCC 15 / newer libstdc++ no longer does, so the build fails with:

moonray/moonray_arras/mcrt_dataio/lib/share/util/ClockDelta.h:60:44: error: 'uint64_t' has not been declared
moonray/moonray_arras/mcrt_dataio/lib/share/util/ClockDelta.h:61:44: error: 'uint64_t' has not been declared
moonray/moonray_arras/mcrt_dataio/lib/share/util/ClockDelta.h:62:44: error: 'uint64_t' has not been declared
moonray/moonray_arras/mcrt_dataio/lib/share/util/ClockDelta.cc:125:1: error: no declaration matches 'float mcrt_dataio::ClockDelta::analyzeRoundTripTimeDelta(uint64_t, uint64_t, uint64_t, float&)'

Fix

Add #include <cstdint> to ClockDelta.h. This is the canonically correct header for the fixed-width integer typedefs and makes the header self-contained.

Testing

Before this change, on GCC 15 (e.g. Arch Linux, Fedora 41+):

echo '#include "ClockDelta.h"' > /tmp/t.cc
g++-15 -std=c++17 -fsyntax-only -I<paths> /tmp/t.cc
# -> error: 'uint64_t' has not been declared (lines 60–62)

After this change, the header compiles cleanly and the full OpenMoonRay build progresses past mcrt_dataio on GCC 15.

Related

Fixes OpenMoonRay/openmoonray#230

The header builds fine on the toolchains DreamWorks ships (older libstdc++) because they happen to leak <cstdint> transitively; this change is a strict tightening that does not affect those builds.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 23, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: wreiske / name: William Reiske (52e0432)

@wreiske
Copy link
Copy Markdown
Author

wreiske commented May 23, 2026

Verification on real GCC 15

I reproduced the original failure from OpenMoonRay/openmoonray#230 and confirmed the fix in a clean Fedora 42 container (GCC 15.2.1), so the change is verified against the exact compiler version reported in the issue rather than just by inspection.

Method

  1. Spun up a Fedora 42 container (docker run --rm -v /tmp/gcc15-test:/work -w /work fedora:42 …) and installed gcc-c++ (GCC 15.2.1 20260123).
  2. Saved two copies of lib/share/util/ClockDelta.h:
    • ClockDelta_original.h — pre-patch (from git show HEAD~1:lib/share/util/ClockDelta.h).
    • ClockDelta_patched.h — post-patch (the change in this PR).
  3. Stubbed mcrt_dataio/share/sock/SockServerInet.h as an empty file so the test could focus on the <cstdint> issue without dragging in the full mcrt_dataio / scene_rdl2 / Boost transitive include graph. Any errors related to SockServerInet in the output below are an artifact of that empty stub — they are not the bug being fixed.
  4. Compiled a one-line TU #include "ClockDelta_<variant>.h" against each header with g++ -std=c++17 -fsyntax-only.

Result

GCC version

g++ (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)

Test 1 — ORIGINAL header (no <cstdint>) — reproduces issue #230:

In file included from test_original.cc:1:
ClockDelta_original.h:50:28: error: 'SockServerInet' has not been declared
   50 |     static bool serverMain(SockServerInet::ConnectionShPtr connection,
      |                            ^~~~~~~~~~~~~~
ClockDelta_original.h:50:60: error: expected ',' or '...' before 'connection'
ClockDelta_original.h:60:44: error: 'uint64_t' has not been declared
   60 |     static float analyzeRoundTripTimeDelta(uint64_t startTime,
      |                                            ^~~~~~~~
ClockDelta_original.h:11:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   10 | #include <string>
  +++ |+#include <cstdint>
   11 | 
ClockDelta_original.h:61:44: error: 'uint64_t' has not been declared
   61 |                                            uint64_t halfWayTime,
      |                                            ^~~~~~~~
ClockDelta_original.h:61:44: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
ClockDelta_original.h:62:44: error: 'uint64_t' has not been declared
   62 |                                            uint64_t endTime,
      |                                            ^~~~~~~~
ClockDelta_original.h:62:44: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
exit=1

The uint64_t has not been declared errors at lines 60–62 match the original bug report verbatim. GCC even suggests the exact fix this PR makes (#include <cstdint>).

Test 2 — PATCHED header (this PR) — uint64_t errors gone:

In file included from test_patched.cc:1:
ClockDelta_patched.h:51:28: error: 'SockServerInet' has not been declared
   51 |     static bool serverMain(SockServerInet::ConnectionShPtr connection,
      |                            ^~~~~~~~~~~~~~
ClockDelta_patched.h:51:60: error: expected ',' or '...' before 'connection'
exit=1

Only the stub-related SockServerInet diagnostics remain. The three uint64_t has not been declared errors from issue #230 are gone, which is the entirety of what this PR is meant to fix.

Conclusion

  • The bug does exist on GCC 15 — <cstdint> is not transitively pulled in by <string> or by SockServerInet.h on modern libstdc++.
  • Adding #include <cstdint> makes ClockDelta.h self-contained and resolves the three errors at lines 60–62 reported in the issue.
  • The change is a strict tightening (adding an include can't break consumers), so it's safe on older toolchains that happened to leak <cstdint> transitively.

ClockDelta.h uses uint64_t in the declaration of
analyzeRoundTripTimeDelta() but does not include <cstdint>. This
previously compiled because older libstdc++ leaked the definition
transitively via other standard headers. GCC 15 / newer libstdc++
no longer does, so the build fails with:

  ClockDelta.h:60:44: error: 'uint64_t' has not been declared
  ClockDelta.h:61:44: error: 'uint64_t' has not been declared
  ClockDelta.h:62:44: error: 'uint64_t' has not been declared

Fixes OpenMoonRay/openmoonray#230

Signed-off-by: William Reiske <wreiske@mieweb.com>
@wreiske wreiske force-pushed the fix/clockdelta-cstdint-gcc15 branch from 52e0432 to 94d2019 Compare May 23, 2026 19:53
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.

Missing #include <cstdint> in ClockDelta.h causes build failure with GCC 15

1 participant