[MacPorts] #68920: boost176 @1.76.0_10 broken after rev-update for new version of icu (on older macOS?)

MacPorts noreply at macports.org
Mon Dec 18 23:04:57 UTC 2023


#68920: boost176 @1.76.0_10 broken after rev-update for new version of icu (on
older macOS?)
------------------------+-----------------------
  Reporter:  snowflake  |      Owner:  michaelld
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:             |   Keywords:
      Port:  boost176   |
------------------------+-----------------------

Comment (by erikbs):

 It was C++17 that introduced the requirement that no constexpr enum be set
 to a value outside its range, but Clang seems to enable this check
 regardless of C++ standard. The patch thus had no effect in itself.
 However, it works perfectly if I up the C++ standard from 2011 to 2017,
 but that raises another question: do we want that? I see that the Portfile
 sets `compiler.cxx_standard` twice, both times to 2011 (in addition, a
 compiler flag for using the GNU dialect is set once). There is a comment
 explaining that Boost does not have such a requirement, but that requiring
 C++11 in MacPorts allows us to build Boost successfully on more platforms.

 These are the changes I did to implement the suggestion in comment 7:

 {{{
 #!diff
 --- devel/boost176/Portfile     2023-12-18 22:01:48.000000000 +0100
 +++ devel/boost176/Portfile     2023-12-18 21:43:58.000000000 +0100
 @@ -38,7 +38,7 @@
  distname        boost_${distver}
  use_bzip2       yes

 -compiler.cxx_standard     2011
 +compiler.cxx_standard     2017
  compiler.blacklist-append {clang < 1000}

  depends_lib-append \
 @@ -144,8 +144,8 @@
  # Further: Building Boost using C++11 compliance does not seem to then
  # require ports depending on Boost to also require C++11 compliance,
  # and requiring it does make such building easier for those ports.
 -configure.cxxflags-append -std=gnu++11
 -compiler.cxx_standard   2011
 +configure.cxxflags-append -std=gnu++17
 +compiler.cxx_standard   2017

  # This flag fixes the return type of unsetenv(3)
  # See: https://trac.macports.org/ticket/63121
 }}}

 {{{
 #!diff
 --- devel/boost176/files/patch-boost-clang16-cpp17-compat.diff  2023-08-13
 02:08:23.000000000 +0200
 +++ devel/boost176/files/patch-boost-clang16-cpp17-compat.diff  2023-12-18
 21:19:50.000000000 +0100
 @@ -83,3 +83,15 @@

     // Metafunction:
     //
 +--- boost/mpl/aux_/integral_wrapper.hpp.orig
 ++++ boost/mpl/aux_/integral_wrapper.hpp
 +@@ -56,7 +56,8 @@ struct AUX_WRAPPER_NAME
 + // have to #ifdef here: some compilers don't like the 'N + 1' form
 (MSVC),
 + // while some other don't like 'value + 1' (Borland), and some don't
 like
 + // either
 +-#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
 ++#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \
 ++    || __cplusplus >= 201703L
 +  private:
 +     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value =
 BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
 +     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value =
 BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
 }}}

 (The patch hunk I added is missing timestamps for the files, I copied in
 the diff from GitHub and added the file name lines instead of running
 `diff -u` locally. It works anyway.)

 What I do not like about the above solution is that it would require
 introducing a C++ standard requirement that is much higher than Boost
 actually needs. One option is enabling C++17 only for compilers that
 support it (Clang 5 and later) or for compilers affected by the constexpr
 enum thing (Clang 16 and later), but at the cost of extra complexity in
 the Portfile. Another solution is to patch in a check for `__clang_major__
 >= 16` instead of `__cplusplus >= 201703L`. That would eliminate the need
 for raising the C++ standard requirement (and even changing the Portfile
 at all). It is also clean and safe, so in my opinion this is actually the
 best solution. It reduces the diff to:

 {{{
 #!diff
 --- devel/boost176/files/patch-boost-clang16-cpp17-compat.diff  2023-08-13
 02:08:23.000000000 +0200
 +++ devel/boost176/files/patch-boost-clang16-cpp17-compat.diff  2023-12-18
 21:19:50.000000000 +0100
 @@ -83,3 +83,15 @@

     // Metafunction:
     //
 +--- boost/mpl/aux_/integral_wrapper.hpp.orig
 ++++ boost/mpl/aux_/integral_wrapper.hpp
 +@@ -56,7 +56,8 @@ struct AUX_WRAPPER_NAME
 + // have to #ifdef here: some compilers don't like the 'N + 1' form
 (MSVC),
 + // while some other don't like 'value + 1' (Borland), and some don't
 like
 + // either
 +-#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
 ++#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \
 ++    || __clang_major__ >= 16
 +  private:
 +     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value =
 BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
 +     BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value =
 BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
 }}}

 I verified that it works on my system, so I created a pull request:
 https://github.com/macports/macports-ports/pull/21839

-- 
Ticket URL: <https://trac.macports.org/ticket/68920#comment:12>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list