Skip to content

[iOS][xcframeworks] Repair stale staged headers in the iOS prebuild - #58596

Open
chrfalch wants to merge 1 commit into
mainfrom
chrfalch/fix-prebuild-stale-header-links
Open

chrfalch wants to merge 1 commit into
mainfrom
chrfalch/fix-prebuild-stale-header-links

Conversation

@chrfalch

@chrfalch chrfalch commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary:

The iOS prebuild (node scripts/ios-prebuild) stages React Native's headers into packages/react-native/.build/headers as hard links, and skipped any target that already existed.

When changing the original source files, these hard links can become stale and errors like this can occur:

Libraries/LinkingIOS/RCTLinkingManager.mm:91:7: error: use of undeclared identifier 'RCTIsSceneDelegateApp'

This is a problem that contributors will see - not regular users, but the fix helps with strange error messages.

Changelog:

[INTERNAL] [FIXED] - Repair stale staged headers in the iOS prebuild instead of compiling against a previous checkout's copies

Test Plan:

✅ New unit tests, 16 cases in packages/react-native/scripts/ios-prebuild/__tests__/setup-test.js, using real temporary directories rather than an fs mock, since the defect is about inodes.

End to end on an Xcode 27 checkout:

  • Replaced a staged header with a copy, so it kept the same contents but a different inode. node scripts/ios-prebuild -s -f Debug restored it to the source inode and logged Linked React/Base → .build/headers/React. The previous code skipped it.
  • Ran setup a second time with nothing changed: no file was relinked, and nothing was logged.
  • Confirmed the three colliding targets still resolve to the same source as before the change, by inode.
  • node scripts/ios-prebuild -b -f Debug -p ios-simulator** BUILD SUCCEEDED **.

@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 Sep 18, 2026
@chrfalch
chrfalch force-pushed the chrfalch/fix-prebuild-stale-header-links branch from 2e0608b to ebdb97a Compare September 18, 2026 16:33
The prebuild stages headers into .build/headers as hard links, and skipped
any target that already existed. A hard link shares an inode, so in-place
edits propagate, but git checkout renames a new file over the source and
gives it a new inode. The staged link then serves the old contents forever
and setup never repairs it, so the build compiles against headers from
whichever commit was checked out when the link was first created.

The staging function now compares the staged file against its source and
relinks it when the inodes differ. Targets a pass has already claimed are
left alone, so sources that flatten onto the same target keep resolving to
the first one visited, as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chrfalch
chrfalch force-pushed the chrfalch/fix-prebuild-stale-header-links branch from ebdb97a to 8f1d214 Compare September 18, 2026 16:38
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 18, 2026
@chrfalch chrfalch changed the title Repair stale staged headers in the iOS prebuild [iOS][xcframeworks] Repair stale staged headers in the iOS prebuild Sep 18, 2026
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