Bug 281534 - devel/py-Levenshtein: fix build with libc++ 19
Summary: devel/py-Levenshtein: fix build with libc++ 19
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dan Langille
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2024-09-16 12:11 UTC by Dimitry Andric
Modified: 2024-10-05 14:12 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (dvl)


Attachments
devel/py-Levenshtein: fix build with libc++ 19 (29.82 KB, patch)
2024-09-16 12: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 2024-09-16 12:11:14 UTC
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 ports using devel/py-Levenshtein to fail to compile with
clang 19 and libc++ 19, resulting in errors similar to:

  /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned int>'
    820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
        |                                          ^
  /wrkdirs/usr/ports/devel/py-Levenshtein/work-py311/Levenshtein-0.22.0/src/Levenshtein/Levenshtein-c/_levenshtein.hpp:144:43: note: in instantiation of template class 'std::basic_string<unsigned int>' requested here
    144 | static inline std::basic_string<uint32_t> lev_greedy_median(const std::vector<RF_String>& strings,
        |                                           ^
  /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
        |                             ^

Unfortunately py-Levenshtein and its embedded copy of rapidfuzz-cpp make
heavy use of the no-longer-existing `std::basic_string<uint8_t>`, so I
had to do quite a lots of search and replace operations, replacing these
with equivalent `std::vector` types.

This is similar to the fixes for devel/rapidfuzz-cpp in bug 281193, and
for devel/py-rapidfuzz in bug 281194.

[1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-09-16 12:12:32 UTC
Created attachment 253601 [details]
devel/py-Levenshtein: fix build with libc++ 19
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-10-05 13:26:20 UTC
A commit in branch main references this bug:

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

commit 849cc48702b5e5f5e4a7931a6acd9f87c3e40893
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-16 12:11:44 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-05 13:24:48 +0000

    devel/py-Levenshtein: 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 ports using devel/py-Levenshtein to fail to compile with
    clang 19 and libc++ 19, resulting in errors similar to:

      /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned int>'
        820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
            |                                          ^
      /wrkdirs/usr/ports/devel/py-Levenshtein/work-py311/Levenshtein-0.22.0/src/Levenshtein/Levenshtein-c/_levenshtein.hpp:144:43: note: in instantiation of template class 'std::basic_string<unsigned int>' requested here
        144 | static inline std::basic_string<uint32_t> lev_greedy_median(const std::vector<RF_String>& strings,
            |                                           ^
      /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
         23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
            |                             ^

    Unfortunately py-Levenshtein and its embedded copy of rapidfuzz-cpp make
    heavy use of the no-longer-existing `std::basic_string<uint8_t>`, so I
    had to do quite a lots of search and replace operations, replacing these
    with equivalent `std::vector` types.

    This is similar to the fixes for devel/rapidfuzz-cpp in bug 281193, and
    for devel/py-rapidfuzz in bug 281194.

    [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals

    PR:             281534
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2024Q3

 ...apidfuzz_details_SplittedSentenceView.hpp (new) |  36 ++++++++
 ...tern_rapidfuzz-cpp_rapidfuzz_distance.hpp (new) |  53 +++++++++++
 ...rapidfuzz_distance_DamerauLevenshtein.hpp (new) |  11 +++
 ...idfuzz-cpp_rapidfuzz_distance_Hamming.hpp (new) |  11 +++
 ...rapidfuzz-cpp_rapidfuzz_distance_Jaro.hpp (new) |  11 +++
 ...zz-cpp_rapidfuzz_distance_JaroWinkler.hpp (new) |  11 +++
 ...pidfuzz-cpp_rapidfuzz_distance_LCSseq.hpp (new) |  11 +++
 ...zz-cpp_rapidfuzz_distance_Levenshtein.hpp (new) |  11 +++
 ..._rapidfuzz-cpp_rapidfuzz_distance_OSA.hpp (new) |  11 +++
 ...idfuzz-cpp_rapidfuzz_distance_Postfix.hpp (new) |  11 +++
 ...pidfuzz-cpp_rapidfuzz_distance_Prefix.hpp (new) |  11 +++
 ...h-extern_rapidfuzz-cpp_rapidfuzz_fuzz.hpp (new) | 100 +++++++++++++++++++++
 ...-extern_rapidfuzz-cpp_rapidfuzz_fuzz.impl (new) |  20 +++++
 ...venshtein_Levenshtein-c___levenshtein.cpp (new) |  16 ++++
 ...venshtein_Levenshtein-c___levenshtein.hpp (new) |  69 ++++++++++++++
 ...atch-src_Levenshtein_levenshtein__cpp.cxx (new) |  74 +++++++++++++++
 ...atch-src_Levenshtein_levenshtein__cpp.pyx (new) |  30 +++++++
 17 files changed, 497 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-10-05 13:26:21 UTC
A commit in branch 2024Q3 references this bug:

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

commit ac1b668fc0c031a9e736a810b5b20665d7ca46c8
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-16 12:11:44 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-05 13:25:53 +0000

    devel/py-Levenshtein: 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 ports using devel/py-Levenshtein to fail to compile with
    clang 19 and libc++ 19, resulting in errors similar to:

      /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits<unsigned int>'
        820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
            |                                          ^
      /wrkdirs/usr/ports/devel/py-Levenshtein/work-py311/Levenshtein-0.22.0/src/Levenshtein/Levenshtein-c/_levenshtein.hpp:144:43: note: in instantiation of template class 'std::basic_string<unsigned int>' requested here
        144 | static inline std::basic_string<uint32_t> lev_greedy_median(const std::vector<RF_String>& strings,
            |                                           ^
      /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
         23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
            |                             ^

    Unfortunately py-Levenshtein and its embedded copy of rapidfuzz-cpp make
    heavy use of the no-longer-existing `std::basic_string<uint8_t>`, so I
    had to do quite a lots of search and replace operations, replacing these
    with equivalent `std::vector` types.

    This is similar to the fixes for devel/rapidfuzz-cpp in bug 281193, and
    for devel/py-rapidfuzz in bug 281194.

    [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals

    PR:             281534
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2024Q3

    (cherry picked from commit 849cc48702b5e5f5e4a7931a6acd9f87c3e40893)

 ...apidfuzz_details_SplittedSentenceView.hpp (new) |  36 ++++++++
 ...tern_rapidfuzz-cpp_rapidfuzz_distance.hpp (new) |  53 +++++++++++
 ...rapidfuzz_distance_DamerauLevenshtein.hpp (new) |  11 +++
 ...idfuzz-cpp_rapidfuzz_distance_Hamming.hpp (new) |  11 +++
 ...rapidfuzz-cpp_rapidfuzz_distance_Jaro.hpp (new) |  11 +++
 ...zz-cpp_rapidfuzz_distance_JaroWinkler.hpp (new) |  11 +++
 ...pidfuzz-cpp_rapidfuzz_distance_LCSseq.hpp (new) |  11 +++
 ...zz-cpp_rapidfuzz_distance_Levenshtein.hpp (new) |  11 +++
 ..._rapidfuzz-cpp_rapidfuzz_distance_OSA.hpp (new) |  11 +++
 ...idfuzz-cpp_rapidfuzz_distance_Postfix.hpp (new) |  11 +++
 ...pidfuzz-cpp_rapidfuzz_distance_Prefix.hpp (new) |  11 +++
 ...h-extern_rapidfuzz-cpp_rapidfuzz_fuzz.hpp (new) | 100 +++++++++++++++++++++
 ...-extern_rapidfuzz-cpp_rapidfuzz_fuzz.impl (new) |  20 +++++
 ...venshtein_Levenshtein-c___levenshtein.cpp (new) |  16 ++++
 ...venshtein_Levenshtein-c___levenshtein.hpp (new) |  69 ++++++++++++++
 ...atch-src_Levenshtein_levenshtein__cpp.cxx (new) |  74 +++++++++++++++
 ...atch-src_Levenshtein_levenshtein__cpp.pyx (new) |  30 +++++++
 17 files changed, 497 insertions(+)
Comment 4 Dan Langille freebsd_committer freebsd_triage 2024-10-05 13:32:41 UTC
Thank you for doing that commit. Sorry that I was not responsive.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2024-10-05 14:12:08 UTC
Let me know if there's any fallout. I hope not :)