Uploaded image for project: 'Core Server'
  1. Core Server
  2. 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

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.0.7
    • Component/s: None
    • None
    • Build
    • ALL

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            ryandesign Ryan Schmidt
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: