Skip to content

Windows nightly: Thrift 0.13.0 build fails with Boost 1.83.0 due to missing NOMINMAX [HZ-5424] #1461

Description

@ihsandemir

Summary

The nightly Windows CI build fails when Thrift 0.13.0 is compiled against Boost 1.83.0. The error originates in boost/locale/util/string.hpp which was introduced in Boost 1.83.0 and calls std::numeric_limits<char>::max() inside a constexpr function.

Failing job: https://github.com/hazelcast/hazelcast-cpp-client/actions/runs/26226738709/job/77175714903
Configuration: Windows · Boost 1.83.0 · Debug · noSSL

Error

C:\Boost\include\boost-1_83\boost\locale\util\string.hpp(41,66): error C2589: '(': illegal token on right side of '::'
C:\Boost\include\boost-1_83\boost\locale\util\string.hpp(41,66): error C2059: syntax error: ')'
C:\Boost\include\boost-1_83\boost\locale\util\string.hpp(39,20): error C3615: constexpr function 'boost::locale::util::to_char' cannot result in a constant expression
  (compiling source file '../../../lib/cpp/src/thrift/protocol/TJSONProtocol.cpp')

Root Cause

On Windows, windows.h defines min and max as macros unless NOMINMAX is defined beforehand. Boost 1.83.0 added boost/locale/util/string.hpp which contains:

constexpr char to_char(int c) noexcept {
    return (c >= 0 && c <= std::numeric_limits<char>::max()) ? ...;
}

Because Thrift 0.13.0 does not define NOMINMAX globally, the max macro corrupts this call at the preprocessor level, causing the C2589/C2059/C3615 errors.

Fix

Pass /DNOMINMAX via CMAKE_CXX_FLAGS when configuring the Thrift CMake build in the Windows CI action. This is a safe, idiomatic Windows fix that defines NOMINMAX before any header is processed and does not affect other configurations.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions