Skip to content

Update vendored fmt from 10.2.1 to 12.1.0#377

Open
Nicolas-nwb wants to merge 1 commit intoml-explore:mainfrom
Nicolas-nwb:update-fmt-12.1.0
Open

Update vendored fmt from 10.2.1 to 12.1.0#377
Nicolas-nwb wants to merge 1 commit intoml-explore:mainfrom
Nicolas-nwb:update-fmt-12.1.0

Conversation

@Nicolas-nwb
Copy link
Copy Markdown

@Nicolas-nwb Nicolas-nwb commented Mar 27, 2026

Proposed changes

Update the vendored fmt library from version 10.2.1 to 12.1.0 to fix compilation errors with Clang 21 (shipped in Xcode 26.4).

Clang 21 tightened consteval rules and rejects expressions in fmt 10.x's format string parser (FMT_STRING macro), causing build failures in format.cc and format-inl.h:

error: call to consteval function is not a constant expression

fmt 12.1.0 includes the fix (fmtlib/fmt#4552, fmtlib/fmt#4546) and is fully backward-compatible with the fmt API surface used by mlx (fmt::format, fmt::runtime, fmt::literals).

Changes

  • Updated Source/Cmlx/fmt/include/fmt/*.h (headers only)
  • Updated Source/Cmlx/fmt/src/format.cc (sole compiled source file)
  • Updated Source/Cmlx/vendor-README.md to reflect the new version
  • Test, doc, and support files left unchanged (excluded from SwiftPM build)

Notes

  • fmt 11.0 introduced base.h and made core.h a backward-compatible shim — no impact since mlx only includes <fmt/format.h>
  • Tested: swift build passes successfully

Checklist

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

Fix compilation with Clang 21 (Xcode 26.4) which rejects consteval
expressions in fmt 10.x format string parser.

Only the compiled/included files are updated (headers + format.cc).
Test, doc, and support files are left unchanged as they are excluded
from the SwiftPM build.

fmt 12.1.0 includes the consteval fix (PR fmtlib/fmt#4552) and is
fully compatible with the existing mlx fmt usage (fmt::format,
fmt::runtime).
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.

1 participant