Skip to content

Compatibility with icu4c@75 from Homebrew #1398

@driskell

Description

@driskell

Homebrew has updated ICU4C and from version 75 it needs C++14 in the build.

Homebrew solves it using this environment variable during build:

https://github.com/Homebrew/homebrew-core/blob/4a5f04e83cb8d7f16f75359ce60ed2a5ab6e0776/Formula/p/php%408.1.rb#L80

Running a build for PHP 8.0 or PHP 8.1 with intl extension will give you this if you've updated icu4c via Homebrew

In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:31:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/utypes.h:39:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/uversion.h:182:11: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
  182 | namespace U_HEADER_ONLY_NAMESPACE {}
      |           ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/uversion.h:180:48: note: expanded from macro 'U_HEADER_ONLY_NAMESPACE'
  180 | #define U_HEADER_ONLY_NAMESPACE U_ICU_NAMESPACE::U_HEADER_NESTED_NAMESPACE
      |                                                ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:37:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:271:38: error: no template named 'enable_if_t' in namespace 'std'
  271 | template<typename T, typename = std::enable_if_t<std::is_same_v<T, UChar>>>
      |                                 ~~~~~^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:271:55: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
  271 | template<typename T, typename = std::enable_if_t<std::is_same_v<T, UChar>>>
      |                                                  ~~~~~^~~~~~~~~
      |                                                       is_same
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_same.h:22:29: note: 'is_same' declared here
   22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> {};
      |                             ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:37:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:273:8: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
  273 |     if constexpr (std::is_same_v<UChar, char16_t>) {
      |        ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:273:24: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
  273 |     if constexpr (std::is_same_v<UChar, char16_t>) {
      |                   ~~~~~^~~~~~~~~
      |                        is_same
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_same.h:22:29: note: 'is_same' declared here
   22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> {};
      |                             ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:37:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:273:50: error: expected unqualified-id
  273 |     if constexpr (std::is_same_v<UChar, char16_t>) {
      |                                                  ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:385:16: warning: variable templates are a C++14 extension [-Wc++14-extensions]
  385 | constexpr bool ConvertibleToU16StringView =
      |                ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:386:10: error: no template named 'is_convertible_v' in namespace 'std'; did you mean 'is_convertible'?
  386 |     std::is_convertible_v<T, std::u16string_view>
      |     ~~~~~^~~~~~~~~~~~~~~~
      |          is_convertible
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_convertible.h:22:29: note: 'is_convertible' declared here
   22 | struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
      |                             ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:37:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:393:5: error: expected '(' for function-style cast or type construction
  386 |     std::is_convertible_v<T, std::u16string_view>
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  387 | #if !U_CHAR16_IS_TYPEDEF && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 180000)
  388 |     || std::is_convertible_v<T, std::basic_string_view<uint16_t>>
  389 | #endif
  390 | #if U_SIZEOF_WCHAR_T==2
  391 |     || std::is_convertible_v<T, std::wstring_view>
  392 | #endif
  393 |     ;
      |     ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:429:36: error: no type named 'enable_if_t' in namespace 'std'
  429 |           typename = typename std::enable_if_t<!std::is_pointer_v<std::remove_reference_t<T>>>>
      |                      ~~~~~~~~~~~~~~^~~~~~~~~~~
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:429:47: error: expected ',' or '>' in template-parameter-list
  429 |           typename = typename std::enable_if_t<!std::is_pointer_v<std::remove_reference_t<T>>>>
      |                                               ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:429:93: error: expected unqualified-id
  429 |           typename = typename std::enable_if_t<!std::is_pointer_v<std::remove_reference_t<T>>>>
      |                                                                                             ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:439:36: error: no type named 'enable_if_t' in namespace 'std'
  439 |           typename = typename std::enable_if_t<std::is_pointer_v<std::remove_reference_t<T>>>,
      |                      ~~~~~~~~~~~~~~^~~~~~~~~~~
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:439:47: error: expected ',' or '>' in template-parameter-list
  439 |           typename = typename std::enable_if_t<std::is_pointer_v<std::remove_reference_t<T>>>,
      |                                               ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/char16ptr.h:439:92: error: expected unqualified-id
  439 |           typename = typename std::enable_if_t<std::is_pointer_v<std::remove_reference_t<T>>>,
      |                                                                                            ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:40:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/stringpiece.h:134:29: error: no template named 'enable_if_t' in namespace 'std'
  134 |             typename = std::enable_if_t<
      |                        ~~~~~^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/stringpiece.h:135:23: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
  135 |                 (std::is_same_v<decltype(T().data()), const char*>
      |                  ~~~~~^~~~~~~~~
      |                       is_same
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_same.h:22:29: note: 'is_same' declared here
   22 | struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> {};
      |                             ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
In file included from /opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:40:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/stringpiece.h:140:17: error: use of address-of-label extension outside of a function body
  140 |                 std::is_same_v<decltype(T().size()), size_t>>>
      |                 ^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/stringpiece.h:140:62: error: expected member name or ';' after declaration specifiers
  140 |                 std::is_same_v<decltype(T().size()), size_t>>>
      |                                                              ^
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.cpp:17:
In file included from /Users/xxxxx/.phpbrew/build/php-8.1.32/ext/intl/intl_convertcpp.h:22:
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:346:40: error: no template named 'enable_if_t' in namespace 'std'
  346 |   template<typename S, typename = std::enable_if_t<ConvertibleToU16StringView<S>>>
      |                                   ~~~~~^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:381:40: error: no template named 'enable_if_t' in namespace 'std'
  381 |   template<typename S, typename = std::enable_if_t<ConvertibleToU16StringView<S>>>
      |                                   ~~~~~^
/opt/homebrew/Cellar/icu4c@77/77.1/include/unicode/unistr.h:1959:40: error: no template named 'enable_if_t' in namespace 'std'
 1959 |   template<typename S, typename = std::enable_if_t<ConvertibleToU16StringView<S>>>
      |                                   ~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.

I can PR a fix that adds environment variable support but I'd prefer if can get #1359 merged first as I've done it on top of that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions