Skip to content

Fix undeclared malloc/free error with libc++-21#4477

Merged
vitaut merged 1 commit intofmtlib:masterfrom
remyjette:fix-clang-21
Jun 21, 2025
Merged

Fix undeclared malloc/free error with libc++-21#4477
vitaut merged 1 commit intofmtlib:masterfrom
remyjette:fix-clang-21

Conversation

@remyjette
Copy link
Contributor

<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/vErfGTh1d

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>.

`<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>`.
@vitaut vitaut merged commit f434546 into fmtlib:master Jun 21, 2025
45 checks passed
@vitaut
Copy link
Contributor

vitaut commented Jun 21, 2025

Thank you for the fix!

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants