Bug 281431 - www/qt5-webengine: fix build with clang and libc++ 19
Summary: www/qt5-webengine: 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: freebsd-kde (group)
URL:
Keywords:
Depends on:
Blocks: 280562
  Show dependency treegraph
 
Reported: 2024-09-11 07:11 UTC by Dimitry Andric
Modified: 2024-09-11 16:26 UTC (History)
1 user (show)

See Also:
jhale: maintainer-feedback+


Attachments
www/qt5-webengine: fix build with clang and libc++ 19 (18.04 KB, patch)
2024-09-11 07:14 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-11 07:11:53 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 www/qt5-webengine 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 short>'
    820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
        |                                          ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/v8/src/inspector/v8-string-conversions.cc:390:26: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here
    390 | std::basic_string<UChar> UTF8ToUTF16(const char* stringStart, size_t length) {
        |                          ^
  /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
     23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
        |                             ^

Upstream v8 has fixed this in commit 182d9c05e78 [2], so add it as a
backported patch, until the next version of qt5-webengine is released.

Also, clang 19 now implements CWG 96 [1], which requires a template
argument list after a 'template' keyword, resulting in errors similar
to:

  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1789:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   1789 |   Allocator::template BackingWriteBarrier(&table_);
        |                       ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1847:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   1847 |   Allocator::template BackingWriteBarrier(&table_);
        |                       ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2015:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   2015 |   Allocator::template BackingWriteBarrier(&table_);
        |                       ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2016:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
   2016 |   Allocator::template BackingWriteBarrier(&other.table_);
        |                       ^

and:

  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:110:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
    110 |     Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
        |                    ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:124:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
    124 |     Base::template Trace([&](typename Base::TraceContext ctx) {
        |                    ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:431:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
    431 |     Base::template Trace([&](typename Base::TraceContext ctx) {
        |                    ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:548:22: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
    548 |       Base::template TraceWithInstances(instances, std::move(lambda));
        |                      ^
  ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:563:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
    563 |     Base::template Trace([&](typename Base::TraceContext ctx) {
        |                    ^

In case of wtf, appending "<>" is enough to satisfy the constraint. For
perfetto, this was fixed by upstream commit e2f661907a [3].

[1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
[2] https://chromium.googlesource.com/v8/v8.git/+/182d9c05e78
[3] https://android.googlesource.com/platform/external/perfetto/+/e2f661907a
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-09-11 07:14:00 UTC
Created attachment 253495 [details]
www/qt5-webengine: fix build with clang and libc++ 19
Comment 2 Jason E. Hale freebsd_committer freebsd_triage 2024-09-11 11:49:37 UTC
Approval granted. Please MFH, as well. Thank you very much for your hard work Dimitry!
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-09-11 16:20:37 UTC
A commit in branch main references this bug:

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

commit 0ddd6468fb3cb9ba390973520517cb1ca2cd690d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-11 07:12:57 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-11 16:17:43 +0000

    www/qt5-webengine: 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 www/qt5-webengine 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 short>'
        820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
            |                                          ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/v8/src/inspector/v8-string-conversions.cc:390:26: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here
        390 | std::basic_string<UChar> UTF8ToUTF16(const char* stringStart, size_t length) {
            |                          ^
      /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
         23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
            |                             ^

    Upstream v8 has fixed this in commit 182d9c05e78 [2], so add it as a
    backported patch, until the next version of qt5-webengine is released.

    Also, clang 19 now implements CWG 96 [1], which requires a template
    argument list after a 'template' keyword, resulting in errors similar
    to:

      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1789:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       1789 |   Allocator::template BackingWriteBarrier(&table_);
            |                       ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1847:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       1847 |   Allocator::template BackingWriteBarrier(&table_);
            |                       ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2015:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       2015 |   Allocator::template BackingWriteBarrier(&table_);
            |                       ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2016:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       2016 |   Allocator::template BackingWriteBarrier(&other.table_);
            |                       ^

    and:

      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:110:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        110 |     Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
            |                    ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:124:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        124 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:431:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        431 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:548:22: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        548 |       Base::template TraceWithInstances(instances, std::move(lambda));
            |                      ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:563:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        563 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^

    In case of wtf, appending "<>" is enough to satisfy the constraint. For
    perfetto, this was fixed by upstream commit e2f661907a [3].

    [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
    [2] https://chromium.googlesource.com/v8/v8.git/+/182d9c05e78
    [3] https://android.googlesource.com/platform/external/perfetto/+/e2f661907a

    PR:             281431
    Approved by:    jhale (maintainer)
    MFH:            2024Q3

 www/qt5-webengine/files/patch-libc++19 (new)       | 176 +++++++++++++++++++++
 ...blink_renderer_platform_wtf_hash__table.h (new) |  31 ++++
 ...ing_internal_track__event__data__source.h (new) |  47 ++++++
 3 files changed, 254 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-09-11 16:23:49 UTC
A commit in branch 2024Q3 references this bug:

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

commit 9689b3535590a801ea7ffaad455981642c6bdfb7
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-09-11 07:12:57 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-09-11 16:22:32 +0000

    www/qt5-webengine: 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 www/qt5-webengine 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 short>'
        820 |   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
            |                                          ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/v8/src/inspector/v8-string-conversions.cc:390:26: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here
        390 | std::basic_string<UChar> UTF8ToUTF16(const char* stringStart, size_t length) {
            |                          ^
      /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here
         23 | struct _LIBCPP_TEMPLATE_VIS char_traits;
            |                             ^

    Upstream v8 has fixed this in commit 182d9c05e78 [2], so add it as a
    backported patch, until the next version of qt5-webengine is released.

    Also, clang 19 now implements CWG 96 [1], which requires a template
    argument list after a 'template' keyword, resulting in errors similar
    to:

      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1789:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       1789 |   Allocator::template BackingWriteBarrier(&table_);
            |                       ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:1847:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       1847 |   Allocator::template BackingWriteBarrier(&table_);
            |                       ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2015:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       2015 |   Allocator::template BackingWriteBarrier(&table_);
            |                       ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/hash_table.h:2016:23: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
       2016 |   Allocator::template BackingWriteBarrier(&other.table_);
            |                       ^

    and:

      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:110:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        110 |     Base::template Trace([](typename Base::TraceContext ctx) { ctx.Flush(); });
            |                    ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:124:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        124 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:431:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        431 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:548:22: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        548 |       Base::template TraceWithInstances(instances, std::move(lambda));
            |                      ^
      ../../../../kde-qtwebengine-5.15.17p3/src/3rdparty/chromium/third_party/perfetto/include/perfetto/tracing/internal/track_event_data_source.h:563:20: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
        563 |     Base::template Trace([&](typename Base::TraceContext ctx) {
            |                    ^

    In case of wtf, appending "<>" is enough to satisfy the constraint. For
    perfetto, this was fixed by upstream commit e2f661907a [3].

    [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
    [2] https://chromium.googlesource.com/v8/v8.git/+/182d9c05e78
    [3] https://android.googlesource.com/platform/external/perfetto/+/e2f661907a

    PR:             281431
    Approved by:    jhale (maintainer)
    MFH:            2024Q3

    (cherry picked from commit 0ddd6468fb3cb9ba390973520517cb1ca2cd690d)

 www/qt5-webengine/files/patch-libc++19 (new)       | 176 +++++++++++++++++++++
 ...blink_renderer_platform_wtf_hash__table.h (new) |  31 ++++
 ...ing_internal_track__event__data__source.h (new) |  47 ++++++
 3 files changed, 254 insertions(+)