Skip to content

Write the prebuilt module-map flag to OTHER_CPLUSPLUSFLAGS too - #57742

Open
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/prebuilt-cxx-module-map-flag
Open

Write the prebuilt module-map flag to OTHER_CPLUSPLUSFLAGS too#57742
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/prebuilt-cxx-module-map-flag

Conversation

@chrfalch

@chrfalch chrfalch commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary:

add_prebuilt_header_search_paths (scripts/cocoapods/rncore.rb) injects the prebuilt ReactNativeHeaders module map 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: 0.86's VFS implementation (add_vfs_overlay_flags) wrote all three compiler-flag keys, the modular rewrite writes two. This adds the third back, reusing the existing quoted module_map_flag.

Xcode's OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS) default doesn't cover for it, because an explicit value replaces the C flags instead of merging — and React Native sets the key explicitly, both in new_architecture.rb and in the pod_target_xcconfig of ReactCodegen, React-RCTAppDelegate and React-RCTAnimatedModuleProvider.

To be clear about what this is: a correctness fix, not a bug fix. No build fails today, because HEADER_SEARCH_PATHS is injected unconditionally and the includes still resolve textually. What is lost is modular resolution.

Changelog:

[IOS] [FIXED] - Write the prebuilt module-map flag to OTHER_CPLUSPLUSFLAGS so C++/ObjC++ sources resolve the relocated namespaces modularly

Test Plan:

On an app using the prebuilt RNCore (RCT_USE_PREBUILT_RNCORE=1, artifacts from Maven), counting pods whose xcconfig carries the module-map flag per key:

OTHER_CFLAGS OTHER_CPLUSPLUSFLAGS OTHER_SWIFT_FLAGS
before 211 0 211
after 211 211 211

xcodebuild succeeds after the change (** BUILD SUCCEEDED **, 0 errors), so the flag is accepted by ScanDependencies and the explicit-module precompile. This was a static-library build; framework linkage was not exercised.

🤖 Generated with Claude Code

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 28, 2026
@facebook-github-tools facebook-github-tools Bot added p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 28, 2026
`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 <[email protected]>
@chrfalch
chrfalch force-pushed the chrfalch/prebuilt-cxx-module-map-flag branch from 424288b to bbf043d Compare July 28, 2026 17:09
@chrfalch
chrfalch requested a review from cipolleschi July 28, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant