[SERVER-85825] Build failure with llvm.org clang 16+ due to boost error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type Created: 27/Jan/24  Updated: 31/Jan/24

Status: Needs Verification
Project: Core Server
Component/s: None
Affects Version/s: 6.0.7
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ryan Schmidt Assignee: Thomas Langston
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Build
Operating System: ALL
Participants:

 Description   

Building mongodb 6.0.7 on macOS 12.7.2 with llvm.org clang 17.0.6 (installed using MacPorts, though that shouldn't be relevant) fails.

I'm using scons flags "-disable-warnings-as-errors=configure", "-disable-warnings-as-errors=source", and "CPPDEFINES=BOOST_NO_CXX98_FUNCTION_BASE" to overcome other issues, as well as other flags for other reasons.

The error this time is:

In file included from src/mongo/db/pipeline/process_interface/mongos_process_interface.cpp:41:
In file included from src/mongo/db/pipeline/document_source_merge.h:33:
In file included from src/mongo/db/pipeline/document_source_writer.h:36:
In file included from src/mongo/db/db_raii.h:35:
In file included from src/mongo/db/stats/top.h:36:
In file included from src/third_party/boost/boost/date_time/posix_time/posix_time.hpp:24:
In file included from src/third_party/boost/boost/date_time/posix_time/time_formatters.hpp:12:
In file included from src/third_party/boost/boost/date_time/gregorian/gregorian.hpp:31:
In file included from src/third_party/boost/boost/date_time/gregorian/gregorian_io.hpp:16:
In file included from src/third_party/boost/boost/date_time/date_facet.hpp:25:
In file included from src/third_party/boost/boost/date_time/date_generator_parser.hpp:20:
In file included from src/third_party/boost/boost/date_time/format_date_parser.hpp:14:
In file included from src/third_party/boost/boost/lexical_cast.hpp:32:
In file included from src/third_party/boost/boost/lexical_cast/try_lexical_convert.hpp:43:
In file included from src/third_party/boost/boost/lexical_cast/detail/converter_numeric.hpp:36:
In file included from src/third_party/boost/boost/numeric/conversion/cast.hpp:33:
In file included from src/third_party/boost/boost/numeric/conversion/converter.hpp:13:
In file included from src/third_party/boost/boost/numeric/conversion/conversion_traits.hpp:13:
In file included from src/third_party/boost/boost/numeric/conversion/detail/conversion_traits.hpp:18:
In file included from src/third_party/boost/boost/numeric/conversion/detail/int_float_mixture.hpp:19:
In file included from src/third_party/boost/boost/mpl/integral_c.hpp:32:
src/third_party/boost/boost/mpl/aux_/integral_wrapper.hpp:73:31: error: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'udt_builtin_mixture_enum' [-Wenum-constexpr-conversion]
   73 |     typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
      |                               ^
src/third_party/boost/boost/mpl/aux_/static_cast.hpp:24:47: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
   24 | #   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
      |                                               ^

I believe mongodb 7.0.5 is still affected because I see the same message, but as a warning rather than an error, when I build mongodb 7.0.5 on macOS 14.2.1 with Apple clang 15.0.0. I don't have llvm.org clang 17.0.6 installed on that system to test it but I believe that it would report that as an error.

The MacPorts project has a ticket tracking this issue for its boost ports as well:

https://trac.macports.org/ticket/69103



 Comments   
Comment by Daniel Moody [ 30/Jan/24 ]

possibly this is fixed in boost 1.81: https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a

Generated at Thu Feb 08 06:58:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.