Unknown argument "merge_framework"?

I have built a mergeable framework for distribution using Xcode 15. But when I try to merge it into an App target using -merge_framework in "Other linker flags", I get the error "Unknown argument: '-merge_framework'"? I'm not sure if the new linker is being used, but I assumed it would be used by default and I'm not sure of a way to enable it if not.

Replies

This is one of those weird gotchas. The Other Linker Flags (OTHER_LDFLAGS) build setting is passed to the compiler driver. You have to tell it to pass those flags on to the linker. So, for example, if you wanted to create a link map, you don’t set it to -map link-map.txt you set it to -XXlinker -map -XXlinker link-map.txt. If you do the same for -merge_framework, it should work.

Having said that, Xcode has high-level build settings for this specific feature, and that’s what you should be using here. See Configuring your project to use mergeable libraries.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I can't understand from the example you provided how it should be on the other_ldflags, Could you explain with an example using -merge_framework, what it should be? I tried setting inside an xcconfig like this. OTHER_LDFLAGS = $(inherited) -Wl,-merge_framework,XXFramework OTHER_LDFLAGS = $(inherited) -map -Wl,-merge_framework,XXFramework OTHER_LDFLAGS = $(inherited) -XXFramework -map -Wl,-merge_framework,XXFramework without much success. it still gives me unknown argument

Add a Comment