fix(fmt): patch base.h consteval gate via prepare_command for Xcode 26.x#2961
Open
tvinhas wants to merge 2 commits into
Open
fix(fmt): patch base.h consteval gate via prepare_command for Xcode 26.x#2961tvinhas wants to merge 2 commits into
tvinhas wants to merge 2 commits into
Conversation
This was referenced May 13, 2026
Open
Open
The xcconfig GCC_PREPROCESSOR_DEFINITIONS approach doesn't actually work: fmt's base.h:113-132 chain has no #ifndef guard and unconditionally redefines FMT_USE_CONSTEVAL=1 on any compiler that sets __cpp_consteval. Patching base.h via prepare_command is the only path that survives the preprocessor. Validated locally on Xcode 26.5: pod install + xcodebuild succeed against both packages/rn-tester and microsoft/react-native-test-app's example-macos.
|
@tvinhas please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
Summary
Patches fmt 11.0.2's
include/fmt/base.hvia the podspec'sprepare_commandto widen the existing "Apple clang < 14 consteval broken" gate so it catches all Apple clang. Xcode 26.x ships a stricter consteval evaluator than fmt 11.0.2expects; the bundled
FMT_STRINGmacro reachesbasic_format_string's consteval constructor and the compiler refuses with:Pods/fmt/include/fmt/format-inl.h:59:24: error: call to consteval function
'fmt::basic_format_string<...>::basic_format_string<FMT_COMPILE_STRING, 0>'
is not a constant expression
(Multiple sites: lines 59, 60, 1387, 1391, 1394, ...)
This blocks every
pod install+xcodebuildcycle on Xcode 26.x for any consumer ofreact-native-macos— including RNTester-macOS on0.83-mergeandmicrosoft/react-native-test-app'sexample-macos.Why
prepare_command(and not xcconfig-D)An earlier version of this PR set
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited) FMT_USE_CONSTEVAL=0"inpod_target_xcconfig. That approach does not actually work: fmt's config chain atbase.h:113-132has no#ifndef FMT_USE_CONSTEVALguard and unconditionally redefines the macro to1on any compiler that sets__cpp_consteval. The-Dfrom the compile command line gets overwritten by the timebasic_format_string's decorator is processed.Verified locally: the macro lands in the generated xcconfig, but compile still fails with the same consteval errors.
Patching the source is the only path that survives clang's preprocessor passes. The existing "Apple clang < 14" branch on
base.h:122-123already disables consteval for compilers fmt's authors consider broken; widening it to catch allApple clang versions extends that fix to Xcode 26.x and falls back to fmt's constexpr path, which compiles cleanly. The constexpr path is fmt's documented fallback and is already battle-tested for MSVC < VS2019 16.10, GCC < 10, and Apple
clang < 14.
The
sed -i.bakedit:defined(apple_build_version) && apple_build_version < 14000029L
→ defined(apple_build_version)
Minimal, mechanical, reversible. Long-term fix is a fmt 11.1+ bump (fmt's own upstream addressed this in subsequent releases); this is the workaround until that bump lands.
Test Plan
xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester-macOS -configuration Debug -destination 'generic/platform=macOS' ARCHS=arm64 buildon0.83-mergefails atCompileC .../fmt.build/.../format.owith the consteval errors above. Reproducible on any Xcode 26.x.xcodebuildproduces** BUILD SUCCEEDED **. Additionally validated againstmicrosoft/react-native-test-app'sexample-macosvia a local Verdaccio publish:pod install+xcodebuild -scheme Exampleboth green,produces a 44 MB
ReactTestApp.applinkinghermesvm.framework.base.h:122line on a clean checkout reads#elif defined(__apple_build_version__)(no version constraint), andFMT_USE_CONSTEVALresolves to0for all Apple clang.Related
React-RCTUIKit.podspecfiles-array fix (also discovered during the same RNTA integration test that surfaced the inadequacy of the xcconfig-only approach)