From 1394f3d60ff25af0927347acc98aa9c79a71eb9d Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Fri, 17 Apr 2026 16:19:18 -0700 Subject: [PATCH] fix(ios): force fmt to c++17 for Xcode 26 Newer Apple Clang toolchains fail to compile fmt 11.0.2 under C++20 with consteval-related errors, blocking simulator builds on Xcode 26. Keep the workaround in Podfile post_install so pod regeneration consistently reapplies FMT_USE_CONSTEVAL=0 and fmt-specific C++17 settings instead of requiring manual edits in Pods/. --- ios/Podfile | 32 ++++++++++++++++++++++++++++++++ ios/Podfile.lock | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ios/Podfile b/ios/Podfile index 322745286c0..b12c435ed45 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -68,6 +68,13 @@ target 'edge' do unless existing_defs.include?('_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST=1') config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = existing_defs + ['_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST=1'] end + + # Xcode 15+/Apple Clang workaround for fmt consteval incompatibility. + # May not be needed when upgrading to newer versions of React Native. + existing_defs = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)'] + unless existing_defs.include?('FMT_USE_CONSTEVAL=0') + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = existing_defs + ['FMT_USE_CONSTEVAL=0'] + end end end @@ -99,6 +106,31 @@ target 'edge' do # :ccache_enabled => true ) + # react_native_post_install resets C++ standards from podspecs. + # Force fmt back to C++17 to avoid Apple Clang consteval failures. + # May not be needed when upgrading to newer versions of React Native. + installer.pods_project.targets.each do |target| + next unless target.name == 'fmt' + + target.build_configurations.each do |config| + config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17' + config.build_settings['OTHER_CPLUSPLUSFLAGS'] = ['$(inherited)', '-std=c++17'] + + xcconfig_ref = config.base_configuration_reference + next if xcconfig_ref.nil? + + xcconfig_path = xcconfig_ref.real_path + next unless File.exist?(xcconfig_path) + + xcconfig = File.read(xcconfig_path) + updated = xcconfig.gsub( + /^CLANG_CXX_LANGUAGE_STANDARD\s*=\s*.*$/, + 'CLANG_CXX_LANGUAGE_STANDARD = c++17' + ) + File.write(xcconfig_path, updated) if updated != xcconfig + end + end + # Remove the -lsqlite3 linker flag. # We already include our own sqlite3 implementation via a pod, # so we don't want the system-provided one as well. diff --git a/ios/Podfile.lock b/ios/Podfile.lock index daf083e8924..5fc5a714e69 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -3500,6 +3500,6 @@ SPEC CHECKSUMS: ZIPFoundation: dfd3d681c4053ff7e2f7350bc4e53b5dba3f5351 ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5 -PODFILE CHECKSUM: ffc45b7c82f76539837854e7add5bc6ad74ef0b6 +PODFILE CHECKSUM: 3c9f8ab9de75f819ada260a3d6d3f372a510d556 COCOAPODS: 1.16.2