fix(ios): build fmt pod as C++17 to fix Xcode 26.4+ consteval error#306
Open
mfazekas wants to merge 1 commit into
Open
fix(ios): build fmt pod as C++17 to fix Xcode 26.4+ consteval error#306mfazekas wants to merge 1 commit into
mfazekas wants to merge 1 commit into
Conversation
b525a27 to
b030dfd
Compare
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+.
b030dfd to
8a3215d
Compare
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.
Problem
Apple clang 21 (Xcode 26.4+) rejects fmt's compile-time
FMT_STRING/constevalas a non-constant-expression, so the iOS build fails compiling fmt'sformat.cc:React Native vendors fmt (
RCT-Folly→fmt 11.0.2on 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
fmtpod as C++17 via aPodfilepost_installbuild setting. Under C++17 fmt'sconstevalpath is disabled (__cpp_constevalabsent), which sidesteps the error. Scoped totarget.name == 'fmt'so the rest of the graph keeps C++20. No vendored-header edits and robust across fmt versions.How others handle it
fmt/base.h(FMT_USE_CONSTEVAL → 0), per expo/expo#44229.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+ — thefmttarget compiles clean.