Skip to content

Conversation

chrfalch
Copy link
Collaborator

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_frameworks to ensure libraries can access their codegen files.

  • Added method that handles this in a generic way
  • Replaced logic for resolving header mappings and module name using the new method resolve_use_frameworks in all podspecs.
  • Add 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.

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 main as 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

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.
@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 Aug 22, 2025
@chrfalch chrfalch changed the title Chrfalch/support dynamic static linkage with prebuilts [iOS][precompile] Support dynamic static linkage with prebuilts Aug 24, 2025
@chrfalch chrfalch marked this pull request as ready for review August 25, 2025 08:44
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 25, 2025
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this fix!

@chrfalch chrfalch requested a review from cipolleschi August 26, 2025 16:31
After a github `suggestion` we had a superfluous `end`. Sorry for that.
@cipolleschi
Copy link
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.

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D81127796.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Aug 27, 2025
@facebook-github-bot
Copy link
Contributor

@cipolleschi merged this pull request in e723ca4.

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. Merged This PR has been merged. 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.

3 participants