1

XCode 15 comes with something called mergeable library, where release builds that have direct dependencies on dylibs or framework are merged into the final executable (iff the project it configured correctly), see here.

I've got a configured XCode 15 project with two targets, one is a dynamic library and another is a command line binary, the latter one depends on the first (the lib is a target dependency and it's listed in the Link binary with libraries thing under Build Phases), also:

  • The library has been configured with the option Build Mergeable Library set to YES
  • The binary has been configured with Create Merged Binary set to Automatic

Still, nothing is merged and the binary does not work if the *.dylib is not available, I would have guessed that merging means merging into the binary, but maybe not.

Also, a library where the merge option has been turned on should have additional metadata of some sort in it, but in my case turning on/off the option does not seems to add/remove anything from the *.dylib (according to vimdiff, at least..)

Does anyone have tried this and is able to make it work?

fjanisze
  • 1,234
  • 11
  • 21

1 Answers1

0

I guess it should work at least for your first dependency, which is a direct dependency.

When you say your dependency is a "dynamic library", I believe it's a dynamic framework? and merging happens in release mode, to verify if your dependency is being merged or not, you can inspect symbols on your main app binary.

Run nm -j //path-to-app-binary | grep <any-class-from-your-dependency>, this should show some results.

if you need more details, you can checkout my article on this - https://medium.com/@SanjuNaik14/meet-mergeable-libraries-790a40aa89b8

Sanju
  • 31
  • 1
  • 4