Repository navigation
[iOS] Fix Hermes Debug builds after installing another pod - #59159
Open
fairysword wants to merge 1 commit into
Open
fairysword wants to merge 1 commit into
fairysword wants to merge 1 commit into
Conversation
cipolleschi
reviewed
Oct 17, 2026
cipolleschi
left a comment
Contributor
There was a problem hiding this comment.
Thanks for fixing this!
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D125847848. |
This branch has not been deployed
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:
A successful Release build followed by adding a new CocoaPods dependency can cause the next Debug build to fail with undefined Hermes debugger symbols, including
CDPDebugAPI::createandCDPAgent::create.The Release build installs the Release Hermes binary and records
ReleaseinPods/hermes-engine/.last_build_configuration. When a subsequentpod installinstalls another pod, CocoaPods cleans the existing Hermes pod. ThePre-builtsubspec does not preserve the configuration marker, so the marker is removed while the Release framework remains on disk.On the next Debug build,
replace_hermes_version.jsreceives the correctDebugconfiguration but assumes that a missing marker means Hermes is already Debug. It skips replacement, leaving Debug React Native code to link against a Release Hermes binary that does not export the required debugger symbols.This change:
.last_build_configurationto thePre-builtsubspec'spreserve_paths, so installing another pod does not discard the configuration recorded for the existing Hermes binary.A matching marker still skips extraction. A fresh Debug installation without a marker now performs one initial extraction; subsequent builds with the same recorded configuration continue to skip it.
Changelog:
[IOS] [FIXED] - Fix Hermes Debug link failures after installing another pod following a Release build.
Test Plan:
Environment
The failure was reproduced in RNTester on the unmodified main baseline
27e77216ef2557ccbf31a01067a44dc1dd2ec846, using:27A266a), iPhoneOS SDK, arm64.260318099.0.2, andhermes-compiler260318099.0.4selected by the repository's installation hook.USE_FRAMEWORKSunset.Both the unmodified and patched versions were tested through complete Debug → Release → add a pod → Debug sequences. Each sequence used the same workspace and DerivedData directory throughout; the patched sequence started with fresh Pods and a separate empty DerivedData directory. JavaScript bundling was enabled. Signing was disabled with
CODE_SIGNING_ALLOWED=NO; the app was not launched on a device.Reproduction on the unmodified baseline
Start with a fresh checkout of the baseline above, without Masonry in RNTester's Podfile. Prepare the repository and RNTester dependencies from the repository root:
On this specific baseline, the checked-in RNTester lockfile references an older Hermes version than the local podspec. The final command aligns that dependency once, matching the repository's RNTester CI setup. This is environment preparation; the dependency installation that triggers the bug below uses ordinary
pod install.Define the build command in the same terminal. The directory is inside RNTester and is shared by Debug and Release:
Build Debug to establish a working baseline:
Result:
BUILD SUCCEEDED.Build Release to simulate a release build:
Result:
BUILD SUCCEEDED. The normal Xcode build phase switches Hermes to Release and writes theReleasemarker.Add a new third-party dependency inside the existing RNTester target in
packages/rn-tester/Podfile:Masonry is a published pod used only to trigger a normal new-pod installation in this reproduction. You can replace it with any other compatible pod that is not already installed in the project.
Install the dependency, retaining the existing Pods and DerivedData directories:
bundle exec pod installResult: installation succeeds and reports
Installing Masonry (1.1.0). The Hermes configuration marker is now absent, but the installed arm64 Hermes binary still matches the Release archive.Build Debug again:
Result:
BUILD FAILED, withxcodebuildexiting with code 65. The failing link is RNTester'sRNTester.debug.dylib; unresolved references originate fromlibReact-hermes.a.The Hermes build phase reports:
The linker reports undefined arm64 symbols, including:
Recorded results before the fix
Releasepod installThe installed arm64 binary's SHA-256 was unchanged across the Masonry installation and matched the Release archive. This confirms that the marker was lost while the Release binary remained installed.
Recorded results with the patch applied
With the patch applied before the initial pod installation, the same sequence passed with fresh Pods and a separate empty DerivedData directory.
DebugReleasepod installReleaseDebugThe Masonry installation reported
Installing Masonry (1.1.0)and retained both theReleasemarker and the Release binary. The next Debug build found the marker, extracted Debug Hermes, wroteDebug, and completed successfully. Binary hashes matched the respective Debug and Release archives at every step.Full RNTester Debug → Release → add Masonry → Debug sequence passed with the patch applied before the initial pod installation.
All seven regression cases passed. From the repository root:
yarn test packages/react-native/scripts/__tests__/replace-hermes-version-test.js --runInBandThe cases cover missing-marker recovery in both directions, matching-marker skips without requiring an archive, normal Debug/Release switches, and recording Debug after a fresh installation without a marker.