[iOS][precompile] Support dynamic static linkage with prebuilts#53432
Closed
[iOS][precompile] Support dynamic static linkage with prebuilts#53432
Conversation
To be able to handle cocoapods USE_FRAMEWORKS with both dynamic/static linkage and precompiled we needed a common way to resolve this. The issue was that when using precompiled and USE_FRAMEWORKS our precompiled framework caused the resulting Pods project to only include header files - hence there where no need to change the header_mappings_dir which a lot of the podspecs did. A method was added that handles this in a common way.
Replaced logic for resolving header mappings and module name using the new method `resolve_use_frameworks` in all podspecs. Also added `React-oscompat` dependency on `React-jsiinspector_modern` which failed when linkage was "dynamic".
When using precompiled and building with frameworks (USE_FRAMEWORKS) we need to explicitly add the correct path to ReactCodegen when calling `create_header_search_path_for_frameworks` to ensure libraries can access their codegen files. This commit adds an explicit check to make sure we add the correct path when using frameworks and the pod is ReactCodegen. Added includes in the NativeCXXModuleExample.cpp file to test this.
7 tasks
cipolleschi
approved these changes
Aug 26, 2025
Contributor
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks for working on this fix!
packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Riccardo Cipolleschi <cipolleschi@meta.com>
After a github `suggestion` we had a superfluous `end`. Sorry for that.
cipolleschi
approved these changes
Aug 27, 2025
Contributor
|
This has been picked in 0.81 by merging #53477 which is this very same PR but opened against the 0.81-stable branch. |
Contributor
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D81127796. |
Contributor
|
@cipolleschi merged this pull request in e723ca4. |
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:
To be able to handle cocoapods USE_FRAMEWORKS with both dynamic/static linkage and precompiled we needed a common way to resolve this.
The issue was that when using precompiled and USE_FRAMEWORKS our precompiled framework caused the resulting Pods project to only include header files - hence there where no need to change the header_mappings_dir which a lot of the podspecs did.
When using precompiled and building with frameworks (USE_FRAMEWORKS) we need to explicitly add the correct path to ReactCodegen when calling
create_header_search_path_for_frameworksto ensure libraries can access their codegen files.resolve_use_frameworksin all podspecs.Changelog:
[IOS] [FIXED] - Fixed using USE_FRAMEWORKS (static/dynamic) with precompiled binaries
Test Plan:
Build RN-Tester with USE_FRAMEWORKS static and dynamic
Tests ran:
✅ Build with source and no USE_FRAMEWORKS
✅ Build with source and USE_FRAMEWORKS = static
🔴 Build with source and USE_FRAMEWORKS = dynamic
Undefined symbols for architecture arm64:
"facebook::react::oscompat::getCurrentProcessId()", referenced from:
facebook::react::jsinspector_modern::HostTargetTraceRecording::start() in HostTargetTraceRecording.o
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
This fails on
mainas well.FIXED when adding dep on React-oscompat when USE_FRAMEWORKS=dynamic:
✅ Build with source and USE_FRAMEWORKS = dynamic
✅ Build with precompiled and no USE_FRAMEWORKS
✅ Build with precompiled and USE_FRAMEWORKS = static
✅ Build with precompiled and USE_FRAMEWORKS = dynamic