Skip to content

Missing #include <cstdint> in CloseableStreamBuf.h breaks build on musl/strict toolchains #3838

@kyusic

Description

@kyusic

Describe the bug

src/aws-cpp-sdk-core/include/aws/core/utils/local/stream/CloseableStreamBuf.h uses int64_t (in the WaitForDrain(int64_t) declarations) but does not #include <cstdint>. It only includes <memory> plus two AWS headers.

On toolchains whose standard library headers do not transitively pull in <cstdint> (e.g. musl libc / Alpine Linux, and some GCC configurations), this fails to compile. On glibc it happens to compile because <cstdint> is pulled in transitively, which is why the problem is easy to miss.

This header was introduced in 1.11.820 (it does not exist in 1.11.740) and is still missing the include on main as of today.

Expected Behavior

CloseableStreamBuf.h compiles on all supported toolchains, including musl/Alpine.

Current Behavior

.../aws/core/utils/local/stream/CloseableStreamBuf.h:21:29: error: 'int64_t' has not been declared
   21 |   virtual bool WaitForDrain(int64_t timeout);
.../aws/core/utils/local/stream/CloseableStreamBuf.h:21:29: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
.../aws/core/utils/local/stream/CloseableStreamBuf.h:31:21: error: 'int64_t' has not been declared
   31 |   bool WaitForDrain(int64_t timeoutMs) override;

which then cascades into the implementation file:

.../source/utils/local/stream/CloseableStreamBuf.cpp:14:6: error: no declaration matches 'bool Aws::Utils::Stream::CloseableStreamBuf::WaitForDrain(int64_t)'

Reproduction Steps

Build aws-cpp-sdk-core with a toolchain that does not transitively include <cstdint> (e.g. GCC on Alpine/musl). We hit it building 1.11.820 via vcpkg on Alpine 3.23 and with musl-based cross compilers; glibc builds (Ubuntu/Fedora) are unaffected.

Possible Solution

Add #include <cstdint> to CloseableStreamBuf.h.

Additional Information/Context

Same class of issue as #3002 (missing includes) and PR #3665 (#include <cstdint> for SecureRandom.h), but CloseableStreamBuf.h is not covered by either.

AWS CPP SDK version used

1.11.820 (also reproduces on current main)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions