Bug 293230 - databases/mongodb70: fix build with clang 21
Summary: databases/mongodb70: fix build with clang 21
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ronald Klop
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-02-16 21:11 UTC by Dimitry Andric
Modified: 2026-02-24 09:35 UTC (History)
0 users

See Also:
ronald: maintainer-feedback+


Attachments
databases/mongodb70: fix build with clang 21 (12.26 KB, patch)
2026-02-16 21:12 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2026-02-16 21:11:03 UTC
With clang 21 databases/mongodb70 fails to build, with errors similar to:

    In file included from src/third_party/boost/libs/log/src/default_sink.cpp:20:
    In file included from src/third_party/boost/boost/thread/locks.hpp:10:
    In file included from src/third_party/boost/boost/thread/lock_algorithms.hpp:11:
    In file included from src/third_party/boost/boost/thread/lock_types.hpp:18:
    In file included from src/third_party/boost/boost/thread/thread_time.hpp:11:
    In file included from src/third_party/boost/boost/date_time/posix_time/posix_time_types.hpp:16:
    In file included from src/third_party/boost/boost/date_time/posix_time/posix_time_duration.hpp:15:
    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:62:51: error: in-class initializer for static data member is not a constant expression
       62 |     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
          |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/third_party/boost/boost/config/detail/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'
      394 | #     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
          |                                                                        ^~~~~~~~~~
    src/third_party/boost/boost/log/utility/strictest_lock.hpp:70:53: note: in instantiation of template class 'mpl_::integral_c<boost::log::lock_access_mode, boost::log::unlocked_access>' requested here
       70 | struct thread_access_mode_of< no_lock< MutexT > > : mpl::integral_c< lock_access_mode, unlocked_access >
          |                                                     ^
    src/third_party/boost/boost/mpl/aux_/integral_wrapper.hpp:62:65: note: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'lock_access_mode'
       62 |     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
          |                                                                 ^
    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)
          |                                               ^

There are two of these cases in the vendored copy of boost in mongodb70,
which have been fixed in boost upstream:
* https://github.com/boostorg/numeric_conversion/commit/50a1eae
* https://github.com/boostorg/log/commit/77f1e20

To fix the errors, port these patches back to the vendored boost.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2026-02-16 21:12:01 UTC
Created attachment 268118 [details]
databases/mongodb70: fix build with clang 21
Comment 2 Ronald Klop freebsd_committer freebsd_triage 2026-02-16 21:53:41 UTC
Thanks for the patch.
I can pick this up in the next few days or maybe 1 or 2 weeks.
If you want to test and commit it yourself I’m fine with that also.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2026-02-17 19:39:31 UTC
(In reply to Ronald Klop from comment #2)
I've built the port with the patches applied, which succeeds. But I don't know how to test it. There is no hurry, if you want to try it out yourself, please have a go.
Comment 4 Ronald Klop freebsd_committer freebsd_triage 2026-02-17 20:57:36 UTC
(In reply to Dimitry Andric from comment #3)
A test script with some basic runtime tests is provided in files/make.test.sh. This can be run standalone or via "make test" or poudriere bulk -t.

I'm doing a test build on 15.0/aarch64. But this does not use llvm 21 yet. I will do that the next few days.
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-02-20 13:06:29 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ab1af9dff06a3eab6e485a27a6eceb7d13d2c50e

commit ab1af9dff06a3eab6e485a27a6eceb7d13d2c50e
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-20 13:00:22 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2026-02-20 13:05:06 +0000

    databases/mongodb70: fix build with clang 21

    With clang 21 databases/mongodb70 fails to build, with errors similar to:

        In file included from src/third_party/boost/libs/log/src/default_sink.cpp:20:
        In file included from src/third_party/boost/boost/thread/locks.hpp:10:
        In file included from src/third_party/boost/boost/thread/lock_algorithms.hpp:11:
        In file included from src/third_party/boost/boost/thread/lock_types.hpp:18:
        In file included from src/third_party/boost/boost/thread/thread_time.hpp:11:
        In file included from src/third_party/boost/boost/date_time/posix_time/posix_time_types.hpp:16:
        In file included from src/third_party/boost/boost/date_time/posix_time/posix_time_duration.hpp:15:
        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:62:51: error: in-class initializer for static data member is not a constant expression
           62 |     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
              |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        src/third_party/boost/boost/config/detail/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'
          394 | #     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
              |                                                                        ^~~~~~~~~~
        src/third_party/boost/boost/log/utility/strictest_lock.hpp:70:53: note: in instantiation of template class 'mpl_::integral_c<boost::log::lock_access_mode, boost::log::unlocked_access>' requested here
           70 | struct thread_access_mode_of< no_lock< MutexT > > : mpl::integral_c< lock_access_mode, unlocked_access >
              |                                                     ^
        src/third_party/boost/boost/mpl/aux_/integral_wrapper.hpp:62:65: note: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'lock_access_mode'
           62 |     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
              |                                                                 ^
        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)
              |                                               ^

    There are two of these cases in the vendored copy of boost in mongodb70,
    which have been fixed in boost upstream:
    * https://github.com/boostorg/numeric_conversion/commit/50a1eae
    * https://github.com/boostorg/log/commit/77f1e20

    To fix the errors, port these patches back to the vendored boost.

    PR:             293230
    MFH:            2026Q1

 ...ost_boost_log_utility_strictest__lock.hpp (new) | 70 ++++++++++++++++++++++
 ...conversion_detail_int__float__mixture.hpp (new) | 23 +++++++
 ...meric_conversion_detail_sign__mixture.hpp (new) | 23 +++++++
 ...nversion_detail_udt__builtin__mixture.hpp (new) | 23 +++++++
 4 files changed, 139 insertions(+)
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2026-02-22 19:45:03 UTC
Ronald, are you going to MFH this change, so we can close this bug?
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-02-24 09:34:46 UTC
A commit in branch 2026Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1236852dbf99c4c5a69db112117d71e8ff2a09d8

commit 1236852dbf99c4c5a69db112117d71e8ff2a09d8
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-20 13:00:22 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2026-02-24 09:33:14 +0000

    databases/mongodb70: fix build with clang 21

    With clang 21 databases/mongodb70 fails to build, with errors similar to:

        In file included from src/third_party/boost/libs/log/src/default_sink.cpp:20:
        In file included from src/third_party/boost/boost/thread/locks.hpp:10:
        In file included from src/third_party/boost/boost/thread/lock_algorithms.hpp:11:
        In file included from src/third_party/boost/boost/thread/lock_types.hpp:18:
        In file included from src/third_party/boost/boost/thread/thread_time.hpp:11:
        In file included from src/third_party/boost/boost/date_time/posix_time/posix_time_types.hpp:16:
        In file included from src/third_party/boost/boost/date_time/posix_time/posix_time_duration.hpp:15:
        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:62:51: error: in-class initializer for static data member is not a constant expression
           62 |     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
              |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        src/third_party/boost/boost/config/detail/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'
          394 | #     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
              |                                                                        ^~~~~~~~~~
        src/third_party/boost/boost/log/utility/strictest_lock.hpp:70:53: note: in instantiation of template class 'mpl_::integral_c<boost::log::lock_access_mode, boost::log::unlocked_access>' requested here
           70 | struct thread_access_mode_of< no_lock< MutexT > > : mpl::integral_c< lock_access_mode, unlocked_access >
              |                                                     ^
        src/third_party/boost/boost/mpl/aux_/integral_wrapper.hpp:62:65: note: integer value -1 is outside the valid range of values [0, 3] for the enumeration type 'lock_access_mode'
           62 |     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
              |                                                                 ^
        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)
              |                                               ^

    There are two of these cases in the vendored copy of boost in mongodb70,
    which have been fixed in boost upstream:
    * https://github.com/boostorg/numeric_conversion/commit/50a1eae
    * https://github.com/boostorg/log/commit/77f1e20

    To fix the errors, port these patches back to the vendored boost.

    PR:             293230
    MFH:            2026Q1
    (cherry picked from commit ab1af9dff06a3eab6e485a27a6eceb7d13d2c50e)

 ...ost_boost_log_utility_strictest__lock.hpp (new) | 70 ++++++++++++++++++++++
 ...conversion_detail_int__float__mixture.hpp (new) | 23 +++++++
 ...meric_conversion_detail_sign__mixture.hpp (new) | 23 +++++++
 ...nversion_detail_udt__builtin__mixture.hpp (new) | 23 +++++++
 4 files changed, 139 insertions(+)
Comment 8 Ronald Klop freebsd_committer freebsd_triage 2026-02-24 09:35:36 UTC
(In reply to Dimitry Andric from comment #6)
It is merged to 2026Q1. No more open actions for this PR.