Static libraries with different deployment target

I am building a C++ application with Xcode 7 on OS X 10.10. My application has deployment target set to 10.7, but I need to link against static libraries that have newer deployment target (10.10). It is not possible to change the deployment target of these libraries. Can I link agaist them anyway?

Thanks

Accepted Reply

Can I link agaist them anyway?

No. Well, you might be able to get it to link, and it might even work if you’re lucky, but it’s most definitely not supported. All components of a linked Mach-O image must use the same deployment target. I’ve seen some wacky and very hard-to-track-down bugs caused by folks not following that rule.

One option is to put the older libraries in their own Mach-O image (a dylib, framework, or bundle). It’s fine to have different deployment targets across image boundaries.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

Can I link agaist them anyway?

No. Well, you might be able to get it to link, and it might even work if you’re lucky, but it’s most definitely not supported. All components of a linked Mach-O image must use the same deployment target. I’ve seen some wacky and very hard-to-track-down bugs caused by folks not following that rule.

One option is to put the older libraries in their own Mach-O image (a dylib, framework, or bundle). It’s fine to have different deployment targets across image boundaries.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"