React Native iOS build fails in fmt with 'call to consteval function ... not a constant expression'
error: call to consteval function 'fmt::basic_format_string<char, ...>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expressionShort answer
React Native's pods pin fmt 11.0.2, and Apple clang 21 in Xcode 26.4 rejects its FMT_STRING calls. The fix is fmt 12.1.0 or newer, which React Native 0.83.5 and the Expo SDK that uses it include. Update the framework, reinstall pods and rebuild. Compiler flags do not fix this.
Fix it fast
1Find out which cause you have
Check which fmt version CocoaPods resolved. A 11.0.2 entry confirms this page; then check your React Native version.
grep -n "fmt" ios/Podfile.lock npx react-native --version2Match what you see, then jump to its fix
- 1
ios/Podfile.lock lists fmt (11.0.2) and the errors point into ios/Pods/fmt/include/fmt/format-inl.h.The project still uses the React Native version that pins fmt 11.0.2Fix - 2
Adding -DFMT_USE_CONSTEVAL=0 to the pod's build settings changes nothing.Trying to switch consteval off with a compiler flagFix
- 1
What does the error look like?
error: call to consteval function 'fmt::basic_format_string<char, ...>::basic_format_string<FMT_COMPILE_STRING, 0>' is not a constant expressionApple clang 21.0.0 (Xcode 26.4) fails in ios/Pods/fmt/include/fmt/format-inl.h
Cause 1 of 2
The project still uses the React Native version that pins fmt 11.0.2
1Check
The fmt issue tracker names fmt 11.0.2, pinned through the RCT-Folly pod, as the affected version, and Apple clang 21.0.0 from Xcode 26.4. The Expo issue reports React Native 0.83.2 with the same errors.
grep -n "fmt\|RCT-Folly" ios/Podfile.lock2Fix
Update to a React Native release that bumps fmt. The Expo issue says React Native 0.83.5 updated fmt to fix Xcode 26.4 builds, and that for an Expo project the fix is to run expo install with the fix flag. Then reinstall pods.
npx expo install --fix
cd ios && pod install3Verify
Confirm the lock file now shows fmt 12.1.0 or newer, then build.
grep -n "fmt" ios/Podfile.lockConfirmed by github.com
Cause 2 of 2
Trying to switch consteval off with a compiler flag
1Check
The fmt issue explains that in 11.0.2 the FMT_USE_CONSTEVAL macro is not wrapped in an ifdef guard, so a -D flag is overwritten. Version 12.1.0 added the guard, and a value you set then takes precedence.
grep -rn "FMT_USE_CONSTEVAL" ios/Podfile ios/Pods/Target\ Support\ Files 2>/dev/null2Fix
Remove the flag and move to fmt 12.1.0 or newer by updating React Native, as in the first cause.
cd ios && pod install3Verify
Clean the build folder in Xcode and build again.
xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug buildConfirmed by github.com
How do I stop it coming back?
- Upgrade React Native patch releases when Apple ships a new Xcode, before you update Xcode on CI.
- Run pod install after every dependency update and commit Podfile.lock.
- Keep one Xcode version per branch on CI so a build does not change under you.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Mobile apps
Running pod on a React Native project fails with can't find gem cocoapods
can't find gem cocoapods (>= 0.a) with executable pod
The pod command exists, but the Ruby that is running it has no CocoaPods gem.
3 causes, each with a fixMobile apps
Axios request works on iOS or in a browser but fails on Android with Network Error
AxiosError: Network Error
A React Native app has no CORS, so on Android a Network Error usually means the request never reached the server.
3 causes, each with a fixMobile apps
Axios returns Network Error in a React Native app on iPhone or the iOS Simulator
error.code is ERR_NETWORK and error.response is undefined
A Network Error means iOS stopped the request before any HTTP answer came back.
3 causes, each with a fixMobile apps
backgroundImage: url(...) does nothing in a React Native view
ImageBackground renders an empty area
In React Native the backgroundImage style draws linear and radial gradients, not pictures, so url(...) is ignored.
3 causes, each with a fixMobile apps
A custom font in React Native falls back to the system font
Unrecognized font family 'MyFont'
React Native does not report a missing font, it just draws the system font.
6 causes, each with a fixMobile apps
fetch fails with TypeError: Network request failed in React Native
Network request failed
Network request failed means the request never got an HTTP response, so there is no status code to read.
3 causes, each with a fix