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
Apple clang 21 (Xcode 26.4+) rejects fmt's compile-time FMT_STRING as a
non-constant-expression, breaking the iOS build (fmt's format.cc). On RN 0.80.3
fmt is pinned to 11.0.2 via RCT-Folly (react/react-native#55601; fmtlib/fmt#4740).

Scope the `fmt` pod to C++17 in Podfile post_install — under C++17 fmt's consteval
path is disabled, sidestepping the error without patching any vendored header and
staying robust across fmt versions. Only the fmt target is affected; the rest of
the graph keeps C++20.

The fix is upstream in React Native 0.83+, so this block can be removed once we
bump to RN 0.83+.
@mfazekas mfazekas force-pushed the fix/ios-fmt-consteval-apple-clang branch from b030dfd to 8a3215d Compare July 1, 2026 10:34
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