Bug 280893 - math/vtk9: fix build with clang and libc++ 19
Summary: math/vtk9: fix build with clang and 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: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2024-08-17 22:17 UTC by Dimitry Andric
Modified: 2024-08-25 11:39 UTC (History)
1 user (show)

See Also:
yuri: maintainer-feedback+


Attachments
math/vtk9: fix build with clang and libc++ 19 (4.24 KB, patch)
2024-08-17 22:20 UTC, Dimitry Andric
yuri: maintainer-approval+
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-08-17 22:17:27 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 math/vtk9 to fail to compile with clang 19 and libc++ 19,
resulting in errors similar to:

    /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/core.h:272:30: error: implicit instantiation of undefined template 'std::char_traits<fmt::char8_t>'
      272 |       : data_(s), size_(std::char_traits<Char>::length(s)) {}
          |                              ^
    /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/format.h:487:9: note: in instantiation of member function 'fmt::basic_string_view<fmt::char8_t>::basic_string_view' requested here
      487 |       : basic_string_view<char8_t>(reinterpret_cast<const char8_t*>(s)) {}
          |         ^
    /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here
       45 | struct char_traits;
          |        ^

This is actually a problem in the vendored version of Victor Zverovich's
fmt library [2]. More recent versions of this library have completely
rewritten this part of the header, so work around the issue by making
the basic_string_view<char8_t> part conditional on char8_t being
actually available. (This is only in C++20 and later.)

Clang 19 now also diagnoses incorrect member accesses, which causes
errors similar to:

    /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/Utilities/octree/octree/octree_node.txx:210:16: error: no member named '_M_chilren' in 'octree_node<T_, d_, A_>'; did you mean 'm_children'?
      210 |   return this->_M_chilren[child];
          |                ^~~~~~~~~~
          |                m_children
    /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/Utilities/octree/octree/octree_node.h:37:23: note: 'm_children' declared here
       37 |   octree_node_pointer m_children;
          |                       ^

This was apparently a typo, and upstream vtk fixed this in
<https://gitlab.kitware.com/vtk/vtk/-/commit/98af50ca33>. Apply that as
a small patch.

[1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
[2] https://fmt.dev/
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-08-17 22:20:31 UTC
Created attachment 252861 [details]
math/vtk9: fix build with clang and libc++ 19
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2024-08-18 02:52:27 UTC
Approved, please commit it.

Thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-08-25 11:33:22 UTC
A commit in branch main references this bug:

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

commit ddd57b6891e71d29dc4a471978df9c27fa8cd0a4
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-17 22:19:32 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-25 11:26:37 +0000

    math/vtk9: fix build with clang and 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 math/vtk9 to fail to compile with clang 19 and libc++ 19,
    resulting in errors similar to:

        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/core.h:272:30: error: implicit instantiation of undefined template 'std::char_traits<fmt::char8_t>'
          272 |       : data_(s), size_(std::char_traits<Char>::length(s)) {}
              |                              ^
        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/format.h:487:9: note: in instantiation of member function 'fmt::basic_string_view<fmt::char8_t>::basic_string_view' requested here
          487 |       : basic_string_view<char8_t>(reinterpret_cast<const char8_t*>(s)) {}
              |         ^
        /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here
           45 | struct char_traits;
              |        ^

    This is actually a problem in the vendored version of Victor Zverovich's
    fmt library [2]. More recent versions of this library have completely
    rewritten this part of the header, so work around the issue by making
    the basic_string_view<char8_t> part conditional on char8_t being
    actually available. (This is only in C++20 and later.)

    Clang 19 now also diagnoses incorrect member accesses, which causes
    errors similar to:

        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/Utilities/octree/octree/octree_node.txx:210:16: error: no member named '_M_chilren' in 'octree_node<T_, d_, A_>'; did you mean 'm_children'?
          210 |   return this->_M_chilren[child];
              |                ^~~~~~~~~~
              |                m_children
        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/Utilities/octree/octree/octree_node.h:37:23: note: 'm_children' declared here
           37 |   octree_node_pointer m_children;
              |                       ^

    This was apparently a typo, and upstream vtk fixed this in
    <https://gitlab.kitware.com/vtk/vtk/-/commit/98af50ca33>. Apply that as
    a small patch.

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

    PR:             280893
    Approved by:    yuri (maintainer)
    MFH:            2024Q3

 ...rty_diy2_vtkdiy2_include_vtkdiy2_fmt_format.h (new) | 18 ++++++++++++++++++
 ...atch-Utilities_octree_octree_octree__node.txx (new) | 11 +++++++++++
 2 files changed, 29 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-08-25 11:38:23 UTC
A commit in branch 2024Q3 references this bug:

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

commit 53fba75278f3ff92091e9709d3d464daafb7c9d9
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-08-17 22:19:32 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-25 11:37:59 +0000

    math/vtk9: fix build with clang and 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 math/vtk9 to fail to compile with clang 19 and libc++ 19,
    resulting in errors similar to:

        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/core.h:272:30: error: implicit instantiation of undefined template 'std::char_traits<fmt::char8_t>'
          272 |       : data_(s), size_(std::char_traits<Char>::length(s)) {}
              |                              ^
        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/format.h:487:9: note: in instantiation of member function 'fmt::basic_string_view<fmt::char8_t>::basic_string_view' requested here
          487 |       : basic_string_view<char8_t>(reinterpret_cast<const char8_t*>(s)) {}
              |         ^
        /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here
           45 | struct char_traits;
              |        ^

    This is actually a problem in the vendored version of Victor Zverovich's
    fmt library [2]. More recent versions of this library have completely
    rewritten this part of the header, so work around the issue by making
    the basic_string_view<char8_t> part conditional on char8_t being
    actually available. (This is only in C++20 and later.)

    Clang 19 now also diagnoses incorrect member accesses, which causes
    errors similar to:

        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/Utilities/octree/octree/octree_node.txx:210:16: error: no member named '_M_chilren' in 'octree_node<T_, d_, A_>'; did you mean 'm_children'?
          210 |   return this->_M_chilren[child];
              |                ^~~~~~~~~~
              |                m_children
        /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.6/Utilities/octree/octree/octree_node.h:37:23: note: 'm_children' declared here
           37 |   octree_node_pointer m_children;
              |                       ^

    This was apparently a typo, and upstream vtk fixed this in
    <https://gitlab.kitware.com/vtk/vtk/-/commit/98af50ca33>. Apply that as
    a small patch.

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

    PR:             280893
    Approved by:    yuri (maintainer)
    MFH:            2024Q3

    (cherry picked from commit ddd57b6891e71d29dc4a471978df9c27fa8cd0a4)

 ...rty_diy2_vtkdiy2_include_vtkdiy2_fmt_format.h (new) | 18 ++++++++++++++++++
 ...atch-Utilities_octree_octree_octree__node.txx (new) | 11 +++++++++++
 2 files changed, 29 insertions(+)