Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shared frameworks with LTO in the React Native iOS prebuild #3652

Open
fealebenpae opened this issue Mar 16, 2021 · 1 comment
Open

Use shared frameworks with LTO in the React Native iOS prebuild #3652

fealebenpae opened this issue Mar 16, 2021 · 1 comment

Comments

@fealebenpae
Copy link
Member

In #3649 we moved to prebuilding the RN iOS source code and shipping it as a set of static libraries packaged in an xcframework. That has a downside in that the static libraries are too big. We should instead build a shared framework, which is smaller, and allows us to use link-time optimization to boot.

It's definitely possible to build a shared framework for iOS from CMake, that's what we do over in the .NET SDK. The main difference is that we don't have to ship headers in the framework in .NET, but here our framework needs to ship a couple of header files, and I wasn't able to figure out the CMake incantation to get it to copy these headers in the final framework bundle.

Once CMake builds frameworks (with the proper headers) for device and simulator xcodebuild -create-xcframework can stitch them together just like it does the static libraries.

@kraenhansen
Copy link
Member

I wonder where this stands with #6650 merged. When we're combining library files using libtool

const { status } = spawnSync("xcrun", ["libtool", "-static", "-D", "-o", outputPath, ...inputPaths], {
we use -static instead of -dynamic and I wonder if that would address this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants