From bbf043d280e1e89c8deffd6b4f5a73dc6390b70d Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Tue, 28 Jul 2026 18:42:46 +0200 Subject: [PATCH] Write the prebuilt module-map flag to OTHER_CPLUSPLUSFLAGS too `ReactNativeCoreUtils.add_prebuilt_header_search_paths` activates the prebuilt ReactNativeHeaders module map by injecting `-fmodule-map-file=...` into `OTHER_CFLAGS` and `OTHER_SWIFT_FLAGS`, but not `OTHER_CPLUSPLUSFLAGS`. C++ and ObjC++ translation units therefore lose modular resolution of the relocated `react/`, `yoga/` and `RCTDeprecation/` namespaces. This is a regression against the VFS implementation this replaced (0.86's `add_vfs_overlay_flags`), which wrote all three compiler-flag keys. Xcode's `OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS)` default does not cover for it, because React Native sets that key explicitly at several sites (`new_architecture.rb`, plus `pod_target_xcconfig` in ReactCodegen, React-RCTAppDelegate and React-RCTAnimatedModuleProvider) and an explicit value replaces the C-flags default for every C++ TU. Co-Authored-By: Claude Opus 5 --- packages/react-native/scripts/cocoapods/rncore.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/scripts/cocoapods/rncore.rb b/packages/react-native/scripts/cocoapods/rncore.rb index f53c935da80..4a62c7808f9 100644 --- a/packages/react-native/scripts/cocoapods/rncore.rb +++ b/packages/react-native/scripts/cocoapods/rncore.rb @@ -572,6 +572,7 @@ def self.add_prebuilt_header_search_paths(attributes, headers_search_path) # Quoted so a $(PODS_ROOT) containing spaces stays a single clang argument. module_map_flag = " \"-fmodule-map-file=$(PODS_ROOT)/React-Core-prebuilt/Headers/module.modulemap\"" ReactNativePodsUtils.add_flag_to_map_with_inheritance(attributes, "OTHER_CFLAGS", module_map_flag) + ReactNativePodsUtils.add_flag_to_map_with_inheritance(attributes, "OTHER_CPLUSPLUSFLAGS", module_map_flag) ReactNativePodsUtils.add_flag_to_map_with_inheritance(attributes, "OTHER_SWIFT_FLAGS", " -Xcc" + module_map_flag) end end