Fix undeclared malloc/free error with libc++-21#4477
Merged
vitaut merged 1 commit intofmtlib:masterfrom Jun 21, 2025
Merged
Conversation
`<cstdlib>` was not being included, so malloc and free were only declared via transitive includes. Some includes changed in the latest libc++-21 build which broke fmt. Also changed `malloc`/`free` to `std::malloc` and `std::free`, as putting those symbols in the global namespace is optional for the implementation when including `<cstdlib>`.
Contributor
|
Thank you for the fix! |
3 tasks
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Sep 21, 2025
libfmt 12.0 brings new optimisations and fixes some compilation issues for clang 21 (fmtlib/fmt#4477). For a detailed release log, see https://github.com/fmtlib/fmt/releases/tag/12.0.0 Pull Request resolved: #163441 Approved by: https://github.com/Skylion007
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
libfmt 12.0 brings new optimisations and fixes some compilation issues for clang 21 (fmtlib/fmt#4477). For a detailed release log, see https://github.com/fmtlib/fmt/releases/tag/12.0.0 Pull Request resolved: pytorch#163441 Approved by: https://github.com/Skylion007
cleonard530
pushed a commit
to cleonard530/pytorch
that referenced
this pull request
Sep 22, 2025
libfmt 12.0 brings new optimisations and fixes some compilation issues for clang 21 (fmtlib/fmt#4477). For a detailed release log, see https://github.com/fmtlib/fmt/releases/tag/12.0.0 Pull Request resolved: pytorch#163441 Approved by: https://github.com/Skylion007
dsashidh
pushed a commit
to dsashidh/pytorch
that referenced
this pull request
Sep 26, 2025
libfmt 12.0 brings new optimisations and fixes some compilation issues for clang 21 (fmtlib/fmt#4477). For a detailed release log, see https://github.com/fmtlib/fmt/releases/tag/12.0.0 Pull Request resolved: pytorch#163441 Approved by: https://github.com/Skylion007
Lawrence37
added a commit
to RawTherapee/RawTherapee
that referenced
this pull request
Dec 17, 2025
Fix a compilation bug in the previous version fmtlib/fmt#4477
mos9527
added a commit
to mos9527/SonyHeadphonesClient
that referenced
this pull request
Feb 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
<cstdlib>was not being included, so malloc and free were only declared via transitive includes. Some includes changed in the latest libc++-21 build which broke fmt: https://godbolt.org/z/vErfGTh1dAlso changed
malloc/freetostd::mallocandstd::free, as putting those symbols in the global namespace is optional for the implementation when including<cstdlib>.