Skip to content

fix(ios): build fmt pod as C++17 to fix Xcode 26.4+ consteval error#306

Open
mfazekas wants to merge 1 commit into
mainfrom
fix/ios-fmt-consteval-apple-clang
Open

fix(ios): build fmt pod as C++17 to fix Xcode 26.4+ consteval error#306
mfazekas wants to merge 1 commit into
mainfrom
fix/ios-fmt-consteval-apple-clang

Conversation

@mfazekas

@mfazekas mfazekas commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

Apple clang 21 (Xcode 26.4+) rejects fmt's compile-time FMT_STRING/consteval as a non-constant-expression, so the iOS build fails compiling fmt's format.cc:

call to consteval function 'fmt::basic_format_string<...>' is not a constant expression

React Native vendors fmt (RCT-Follyfmt 11.0.2 on our RN 0.80.3). CI doesn't hit it (Xcode 26.3); local builds on 26.4+/26.5 do. Tracked in facebook/react-native#55601 and fmtlib/fmt#4740.

Fix

Compile only the fmt pod as C++17 via a Podfile post_install build setting. Under C++17 fmt's consteval path is disabled (__cpp_consteval absent), which sidesteps the error. Scoped to target.name == 'fmt' so the rest of the graph keeps C++20. No vendored-header edits and robust across fmt versions.

How others handle it

  • React Native ≥ 0.83 — fixed upstream (the real solution).
  • Expo (interim) — a config plugin that patches fmt/base.h (FMT_USE_CONSTEVAL → 0), per expo/expo#44229.
  • RN community — the fmt-as-C++17 build setting used here.

All interim options disable fmt's consteval path; this is the bare-RN one.

Longevity

This is only needed because we're on RN 0.80.3. Remove this block once we bump to RN 0.83+, which carries the upstream fix (also noted in the Podfile comment).

Verify

pod install, then build the iOS example on Xcode 26.4+ — the fmt target compiles clean.

@mfazekas mfazekas force-pushed the fix/ios-fmt-consteval-apple-clang branch from b525a27 to b030dfd Compare July 1, 2026 10:30
@mfazekas mfazekas changed the title fix(ios): disable fmt consteval on Apple clang (Xcode 26.4+, fmtlib/fmt#4740) fix(ios): build fmt pod as C++17 to fix Xcode 26.4+ consteval error Jul 1, 2026
@mfazekas mfazekas force-pushed the fix/ios-fmt-consteval-apple-clang branch from b030dfd to 8a3215d Compare July 1, 2026 10:34
@mfazekas mfazekas force-pushed the fix/ios-fmt-consteval-apple-clang branch 2 times, most recently from 822413e to cb2063a Compare July 2, 2026 14:02
mfazekas added a commit that referenced this pull request Jul 3, 2026
…314)

Cherry-picks the `fmt`-as-C++17 Podfile workaround onto the experimental
backend line so its iOS build survives the Xcode 26.4+ (Apple clang 21)
`consteval` error in `fmt` (via RCT-Folly on RN 0.80.3).

Same change as #306 (which targets `main`); applies cleanly here and the
branch had no prior fmt workaround. Remove once we bump to RN 0.83+ (fix
is upstream there).
Xcode 26.4+ (Apple clang 21) rejects fmt's compile-time FMT_STRING (consteval) as non-constant. Compiling only the fmt pod as C++17 makes fmt's base.h disable consteval (FMT_CPLUSPLUS < 201709 -> FMT_USE_CONSTEVAL 0). A -DFMT_USE_CONSTEVAL=0 define does NOT work: base.h re-#defines the macro unconditionally and overrides it. Verified building on Xcode 26.6. Fixed upstream in RN 0.83+.
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