Description:
Building MySQL 8.0.42 from source fails with this error:
```
error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
```
This prevents Homebrew builds MySQL from source.
https://github.com/Homebrew/homebrew-core/pull/220843
long version:
```
In file included from /private/tmp/mysql-clientA8.0-20250421-33741-1ykyuw/mysql-8.0.42/client/mysqlbinlog.cc:45:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/map:2175:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/functional:552:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__functional/boyer_moore_searcher.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/vector:325:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/formatter_bool.h:19:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/formatter_integral.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/formatter_output.h:22:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/parser_std_format_spec.h:39:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/string:821:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
821 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,
| ^
/private/tmp/mysql-clientA8.0-20250421-33741-1ykyuw/mysql-8.0.42/sql/rpl_log_encryption.h:821:14: note: in instantiation of template class 'std::basic_string<unsigned char>' requested here
821 | Key_string m_encrypted_password;
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
| ^
In file included from /private/tmp/mysql-clientA8.0-20250421-33741-1ykyuw/mysql-8.0.42/client/mysqlbinlog.cc:45:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/map:2175:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/functional:552:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__functional/boyer_moore_searcher.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/vector:325:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/formatter_bool.h:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/concepts.h:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__format/format_parse_context.h:16:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/string_view:300:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned char>'
300 | static_assert(is_same<_CharT, typename traits_type::char_type>::value,
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/__type_traits/is_convertible.h:22:99: note: in instantiation of template class 'std::basic_string_view<unsigned char>' requested here
22 | struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible(_T1, _T2)> {};
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/string:746:29: note: in instantiation of template class 'std::is_convertible<const std::basic_string<unsigned char> &, std::basic_string_view<unsigned char>>' r
746 | : public _BoolConstant< is_convertible<const _Tp&, basic_string_view<_CharT, _Traits> >::value &&
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/string:1152:27: note: in instantiation of template class 'std::__can_be_converted_to_string_view<unsigned char, std::char_traits<unsigned char>, std::basic_stri
1152 | __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/c++/v1/string:1155:93: note: while substituting prior template arguments into non-type template parameter [with _Tp = std::basic_string<unsigned char>]
1155 | _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1156 | : __r_(__default_init_tag(), __default_init_tag()) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1157 | __self_view __sv = __t;
| ~~~~~~~~~~~~~~~~~~~~~~~
1158 | __init(__sv.data(), __sv.size());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1159 | }
| ~
```
How to repeat:
$ HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source mysql@8.0 -v
But regular build-from-source will cause same error.
```
$ clang --version
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```
Suggested fix:
Backport this commit to 8.0 branch.
https://github.com/mysql/mysql-server/commit/cceb500e8aa52d87d75851e13f9e315418bca724