Skip to content

Conversation

@jamesnrokt
Copy link
Collaborator

Background

  • mParticle Apple SDK was previously configured for dynamic linking
  • Dynamic linking was causing issues for downstream wrapper SDKs
  • Static linking provides better performance by eliminating dynamic library loading overhead at runtime
  • This change aligns with industry best practices for performance-critical SDKs

What Has Changed

  • Updated Xcode project build settings to use static linking (MACH_O_TYPE = staticlib)
  • Removed dynamic library specific settings (DYLIB_* and LD_RUNPATH_SEARCH_PATHS configurations)
  • Verified XCFramework builds produce static libraries instead of dynamic libraries using scripts/xcframework.sh
  • Additionally added new PR template

Screenshots/Video

  • Before: file command shows dynamically linked shared library
  • After: file command shows current ar archive (static library)
  • XCFramework build logs now show MACH_O_TYPE=staticlib and static framework signing

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Additional Notes

  • Binary Compatibility: XCFrameworks are rebuilt as static libraries but maintain same API surface
  • Integration: No changes required for existing CocoaPods or SPM integrations
  • Testing: Successfully built and verified static XCFrameworks for both iOS and tvOS platforms

Reference Issue (For employees only. Ignore if you are an outside contributor)

  • Closes N/A

@jamesnrokt jamesnrokt requested a review from a team as a code owner September 30, 2025 01:26
Copy link
Collaborator

@BrandonStalnaker BrandonStalnaker left a comment

Choose a reason for hiding this comment

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

At first I was worried but as I looked into it most of my concerns seemed unfounded. I would appreciate if we could test this alongside a few kits on an SPM sample app and a cocoapods sample app before we merge. We don't need end to end tests on the kits, just to be sure they get initialized and sent events.

React Native
I know React Native can handle static frameworks just fine (prefers them even) but we will need to update docs and guides to support that. (other wrapper SDKs too possibly?)

All in all this looks good

Copy link
Contributor

@denischilik denischilik left a comment

Choose a reason for hiding this comment

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

LGTM

@jamesnrokt jamesnrokt closed this Nov 14, 2025
@jamesnrokt jamesnrokt deleted the perf/migrate-to-static-linking branch December 9, 2025 22:16
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

Successfully merging this pull request may close these issues.

5 participants