Bug 293182 - multimedia/mkvtoolnix: fix build with libc++ 21
Summary: multimedia/mkvtoolnix: fix build with libc++ 21
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thomas Zander
URL:
Keywords:
Depends on:
Blocks: 292067
  Show dependency treegraph
 
Reported: 2026-02-14 21:54 UTC by Dimitry Andric
Modified: 2026-02-15 22:12 UTC (History)
0 users

See Also:
riggs: maintainer-feedback+


Attachments
multimedia/mkvtoolnix: fix build with libc++ 21 (1.55 KB, patch)
2026-02-14 21:55 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 2026-02-14 21:54:20 UTC
With libc++ 21 multimedia/mkvtoolnix fails to build, with errors similar
to:

    In file included from lib/fmt/src/os.cc:13:
    In file included from lib/fmt/include/fmt/os.h:11:
    lib/fmt/include/fmt/format.h:745:28: fatal error: use of undeclared identifier 'malloc'
      745 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
          |                            ^~~~~~

This is because malloc and free are defined in <cstdlib>, and os.h does
not explicitly include it. (Before libc++ 21, the fmt library was
"lucky" that <cstdlib> was included transitively, but this is no longer
the case.)
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2026-02-14 21:55:37 UTC
Created attachment 268058 [details]
multimedia/mkvtoolnix: fix build with libc++ 21
Comment 2 Thomas Zander freebsd_committer freebsd_triage 2026-02-15 16:07:48 UTC
(In reply to Dimitry Andric from comment #1)

LGTM, go ahead.

While on it, can you file an upstream bug at https://codeberg.org/mbunkus/mkvtoolnix/issues unless there is already one? Thanks!
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2026-02-15 21:49:18 UTC
(In reply to Thomas Zander from comment #2)
https://codeberg.org/mbunkus/mkvtoolnix/issues/6191

They're using a git submodule for fmt, so they'll have to bump the submodule to a new version.
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-02-15 22:00:11 UTC
A commit in branch main references this bug:

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

commit 4d7c78c3d2e4d40c851da6e6161d29d6a62d3b31
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-14 21:55:01 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-02-15 21:59:17 +0000

    multimedia/mkvtoolnix: fix build with libc++ 21

    With libc++ 21 multimedia/mkvtoolnix fails to build, with errors similar
    to:

        In file included from lib/fmt/src/os.cc:13:
        In file included from lib/fmt/include/fmt/os.h:11:
        lib/fmt/include/fmt/format.h:745:28: fatal error: use of undeclared identifier 'malloc'
          745 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
              |                            ^~~~~~

    This is because malloc and free are defined in <cstdlib>, and os.h does
    not explicitly include it. (Before libc++ 21, the fmt library was
    "lucky" that <cstdlib> was included transitively, but this is no longer
    the case.)

    PR:             293182
    Approved by:    riggs (maintainer)
    MFH:            2026Q1

 .../mkvtoolnix/files/patch-lib_fmt_include_fmt_format.h (new)  | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-02-15 22:00:12 UTC
A commit in branch 2026Q1 references this bug:

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

commit c6fe30f32c249aabb6db44c5368225089c562fd7
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-02-14 21:55:01 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-02-15 21:59:44 +0000

    multimedia/mkvtoolnix: fix build with libc++ 21

    With libc++ 21 multimedia/mkvtoolnix fails to build, with errors similar
    to:

        In file included from lib/fmt/src/os.cc:13:
        In file included from lib/fmt/include/fmt/os.h:11:
        lib/fmt/include/fmt/format.h:745:28: fatal error: use of undeclared identifier 'malloc'
          745 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
              |                            ^~~~~~

    This is because malloc and free are defined in <cstdlib>, and os.h does
    not explicitly include it. (Before libc++ 21, the fmt library was
    "lucky" that <cstdlib> was included transitively, but this is no longer
    the case.)

    PR:             293182
    Approved by:    riggs (maintainer)
    MFH:            2026Q1

    (cherry picked from commit 4d7c78c3d2e4d40c851da6e6161d29d6a62d3b31)

 .../mkvtoolnix/files/patch-lib_fmt_include_fmt_format.h (new)  | 10 ++++++++++
 1 file changed, 10 insertions(+)