Bug 271953 - japanese/zinnia: fix build with clang 16
Summary: japanese/zinnia: fix build with clang 16
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: 271047
  Show dependency treegraph
 
Reported: 2023-06-11 17:04 UTC by Dimitry Andric
Modified: 2023-06-13 06:28 UTC (History)
2 users (show)

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


Attachments
japanese/zinnia: fix build with clang 16 (1.65 KB, patch)
2023-06-11 17:05 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 2023-06-11 17:04:54 UTC
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because japanese/zinnia's build infrastructure does not explicitly set
its C++ standard, this leads to an error:

  svm.cpp:50:10: error: no member named 'random_shuffle' in namespace 'std'
      std::random_shuffle(index.begin(), index.begin() + active_size);
      ~~~~~^

This is because std::random_shuffle has been removed from C++17. An
suitable replacement is std::shuffle, using a std::random_device in
combination with std::mt19937 as the random number engine.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-06-11 17:05:13 UTC
Created attachment 242736 [details]
japanese/zinnia: fix build with clang 16
Comment 2 Fernando Apesteguía freebsd_committer freebsd_triage 2023-06-12 08:41:59 UTC
^Triage: reporter is committer, assign accordingly.

Builds fine in 12.4{amd64,i386}, 13.2amd64 and 14-current(ish) amd64.

LGTM!
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-06-12 18:38:02 UTC
A commit in branch main references this bug:

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

commit abdd4cf0e5ab5f26b366d9ab86644ebaacd85624
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-06-11 17:01:12 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-06-12 18:36:01 +0000

    japanese/zinnia: fix build with clang 16

    Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
    Because japanese/zinnia's build infrastructure does not explicitly set
    its C++ standard, this leads to an error:

      svm.cpp:50:10: error: no member named 'random_shuffle' in namespace 'std'
          std::random_shuffle(index.begin(), index.begin() + active_size);
          ~~~~~^

    This is because std::random_shuffle has been removed from C++17. An
    suitable replacement is std::shuffle, using a std::random_device in
    combination with std::mt19937 as the random number engine.

    PR:             271953
    Approved by:    fernape
    MFH:            2023Q2

 japanese/zinnia/Makefile                  |  2 +-
 japanese/zinnia/files/patch-svm.cpp (new) | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
Comment 4 Timothy Beyer 2023-06-13 06:28:13 UTC
sounds great, thanks, maintainer approved