As noted in the libc++ 19 release notes [1], std::char_traits<> is now only provided for char, char8_t, char16_t, char32_t and wchar_t, and any instantiation for other types will fail. This causes cad/kicad-devel to fail to compile with clang 19 and libc++ 19, resulting in errors similar to: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:261:25: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 261 | auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3576:52: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3576 | dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3578:49: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3578 | string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3629:54: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3629 | drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::length(descr)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ and: /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/compoundfilereader/compoundfilereader.h:226:21: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here 226 | utf16string dir; | ^ /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; | ^ and: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:3604:22: error: implicit instantiation of undefined template 'std::char_traits<wxUniChar>' 3604 | struct char_traits : std::char_traits<T> | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6289:14: note: in instantiation of template class 'nlohmann::detail::char_traits<wxUniChar>' requested here 6289 | typename char_traits<char_type>::int_type get_character() | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6465:22: note: in instantiation of template class 'nlohmann::detail::iterator_input_adapter<wxString::const_iterator>' requested here 6465 | BaseInputAdapter base_adapter; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:23323:16: note: in instantiation of template class 'nlohmann::detail::wide_string_input_adapter<nlohmann::detail::iterator_input_adapter<wxString::const_iterator>, wxUniChar>' requested here 23323 | parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(true, result); | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp:209:53: note: in instantiation of function template specialization 'nlohmann::basic_json<>::parse<wxString>' requested here 209 | nlohmann::json js = nlohmann::json::parse( txt.ReadLine() ); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ The first batch of errors can be fixed by providing a simple `length()` function for the `NANODBC_SQLCHAR const*` type. The second batch can be fixed by using `std::basic_string<char16_t>` for `utf16string`, and adjusting the call to `std::basic_string<char16_t>::append`. The third batch can be fixed by adding a `char_traits` definition specifically for the `wxUniChar` type. [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
Created attachment 254898 [details] cad/kicad-devel: fix build with libc++ 19
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=1b22fed46cec0d16c24ead535ebfe329981f9a20 commit 1b22fed46cec0d16c24ead535ebfe329981f9a20 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-11-03 10:57:05 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-11-17 18:45:21 +0000 cad/kicad-devel: fix build with libc++ 19 As noted in the libc++ 19 release notes [1], std::char_traits<> is now only provided for char, char8_t, char16_t, char32_t and wchar_t, and any instantiation for other types will fail. This causes cad/kicad-devel to fail to compile with clang 19 and libc++ 19, resulting in errors similar to: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:261:25: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 261 | auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3576:52: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3576 | dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3578:49: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3578 | string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3629:54: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3629 | drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::length(descr)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ and: /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/compoundfilereader/compoundfilereader.h:226:21: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here 226 | utf16string dir; | ^ /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; | ^ and: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:3604:22: error: implicit instantiation of undefined template 'std::char_traits<wxUniChar>' 3604 | struct char_traits : std::char_traits<T> | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6289:14: note: in instantiation of template class 'nlohmann::detail::char_traits<wxUniChar>' requested here 6289 | typename char_traits<char_type>::int_type get_character() | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6465:22: note: in instantiation of template class 'nlohmann::detail::iterator_input_adapter<wxString::const_iterator>' requested here 6465 | BaseInputAdapter base_adapter; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:23323:16: note: in instantiation of template class 'nlohmann::detail::wide_string_input_adapter<nlohmann::detail::iterator_input_adapter<wxString::const_iterator>, wxUniChar>' requested here 23323 | parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(true, result); | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp:209:53: note: in instantiation of function template specialization 'nlohmann::basic_json<>::parse<wxString>' requested here 209 | nlohmann::json js = nlohmann::json::parse( txt.ReadLine() ); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ The first batch of errors can be fixed by providing a simple `length()` function for the `NANODBC_SQLCHAR const*` type. The second batch can be fixed by using `std::basic_string<char16_t>` for `utf16string`, and adjusting the call to `std::basic_string<char16_t>::append`. The third batch can be fixed by adding a `char_traits` definition specifically for the `wxUniChar` type. [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals PR: 282512 Approved by: maintainer timeout (2 weeks) MFH: 2024Q4 ...ch__io_easyedapro_sch__io__easyedapro.cpp (new) | 34 +++++++++++++++++ ...y_compoundfilereader_compoundfilereader.h (new) | 20 ++++++++++ ...ch-thirdparty_nanodbc_nanodbc_nanodbc.cpp (new) | 44 ++++++++++++++++++++++ 3 files changed, 98 insertions(+)
A commit in branch 2024Q4 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=e821fb45708aa81597a11a5b8ccc744ae55168de commit e821fb45708aa81597a11a5b8ccc744ae55168de Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-11-03 10:57:05 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-11-17 18:46:11 +0000 cad/kicad-devel: fix build with libc++ 19 As noted in the libc++ 19 release notes [1], std::char_traits<> is now only provided for char, char8_t, char16_t, char32_t and wchar_t, and any instantiation for other types will fail. This causes cad/kicad-devel to fail to compile with clang 19 and libc++ 19, resulting in errors similar to: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:261:25: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 261 | auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3576:52: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3576 | dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3578:49: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3578 | string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3629:54: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 3629 | drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::length(descr)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ and: /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' 820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/compoundfilereader/compoundfilereader.h:226:21: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here 226 | utf16string dir; | ^ /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; | ^ and: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:3604:22: error: implicit instantiation of undefined template 'std::char_traits<wxUniChar>' 3604 | struct char_traits : std::char_traits<T> | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6289:14: note: in instantiation of template class 'nlohmann::detail::char_traits<wxUniChar>' requested here 6289 | typename char_traits<char_type>::int_type get_character() | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6465:22: note: in instantiation of template class 'nlohmann::detail::iterator_input_adapter<wxString::const_iterator>' requested here 6465 | BaseInputAdapter base_adapter; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:23323:16: note: in instantiation of template class 'nlohmann::detail::wide_string_input_adapter<nlohmann::detail::iterator_input_adapter<wxString::const_iterator>, wxUniChar>' requested here 23323 | parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(true, result); | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp:209:53: note: in instantiation of function template specialization 'nlohmann::basic_json<>::parse<wxString>' requested here 209 | nlohmann::json js = nlohmann::json::parse( txt.ReadLine() ); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ The first batch of errors can be fixed by providing a simple `length()` function for the `NANODBC_SQLCHAR const*` type. The second batch can be fixed by using `std::basic_string<char16_t>` for `utf16string`, and adjusting the call to `std::basic_string<char16_t>::append`. The third batch can be fixed by adding a `char_traits` definition specifically for the `wxUniChar` type. [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals PR: 282512 Approved by: maintainer timeout (2 weeks) MFH: 2024Q4 (cherry picked from commit 1b22fed46cec0d16c24ead535ebfe329981f9a20) ...ch__io_easyedapro_sch__io__easyedapro.cpp (new) | 34 +++++++++++++++++ ...y_compoundfilereader_compoundfilereader.h (new) | 20 ++++++++++ ...ch-thirdparty_nanodbc_nanodbc_nanodbc.cpp (new) | 44 ++++++++++++++++++++++ 3 files changed, 98 insertions(+)