Backwards compatibility of binaries linked against OS X 10.11 SDK

Hi, when compiling my app on OS X 10.11 with Xcode 7 and then trying to run it on OS X 10.10, it crashes shortly after launch with the message


Dyld Error Message:

Symbol not found: _AudioUnitGetProperty

Referenced from: /Users/USER/Amadeus Pro.app/Contents/MacOS/Amadeus Pro

Expected in: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox


Indeed, when I dump the symbols of AudioToolbox on 10.11, I see _AudioUnitGetProperty, while on 10.10 I see __AT_AudioUnitGetProperty instead. For what it's worth, in Xcode 7 my app is linked against the 10.11 SDK, but targets OS X 10.6. Compiling the same project with Xcode 6.3 on 10.10 against the 10.10 SDK works fine and results in a binary that indeed runs on all versions of OS X down to 10.6. I would be very grateful for any idea of how to fix this, thanks in advance!

I don't know how you do this in Xcode (I'm a command-line guy), but the Clang options you want are


-isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk

-macosx-version-min=10.10


That compiles against the OS X 10.10 headers, which is a brute-force (but effective) way of maing sure you don't use any OS X 10.11 calls, abd links in the format of OS X 10.10. This does restrict you to using 10.10 features.


The more complex way to do it is to know which of the APIs you're using are 10.11 ones, and use weak linking for them. That lets you check for them at run-time and do something else if they aren't available. I've never actually needed to do this, so I don't know all the details.


John

Thanks, yes this would work I suppose, but it would break in a year when the 10.10 SDK is no longer available in Xcode 8... I am pretty sure that I am not using any 10.11 APIs and that I am weak-linking: when compiling against the 10.10 SDK, it runs perfectly fine all the way down to OS X 10.6 even though I do use some 10.7 APIs when they are available. This really seems specific to the 10.11 SDK somehow.

Well, best of luck! I concluded that I needed to update my build standard for every OS X some years ago.

For future reference, the workaround given at https://forums.developer.apple.com/message/16100#16100 worked for me. Sounds like a bug since the order of linking system frameworks should be irrelevant.

Backwards compatibility of binaries linked against OS X 10.11 SDK
 
 
Q