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.)
Created attachment 268058 [details] multimedia/mkvtoolnix: fix build with libc++ 21
(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!
(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.
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(+)
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(+)