Hello
Well, that's another interesting case of a buggy SDK! I'm almost certain this project wouldn't build with today's Xcode.
Apple sometimes changes the layout of their SDK. Before, AVFAudio was a sub-framework of AVFoundation (located in /System/Library/Frameworks/AVFoundation.framework/Frameworks/AVFAudio.framework) and now it's become a framework by itself, located in /System/Library/Frameworks directly.
But, the fact that the linker *still* looks for it in
%
ld: file not found: /System/Library/Frameworks/AVFoundation.framework/Frameworks/AVFAudio.framework/AVFAudio for architecture armv7
%
...indicates that in the Text Binary Description file that describes the contents of the AVFoundation framework, the path to the no longer existing AVFAudio framework is still here!
And indeed, if you open SDK\System\Library\Frameworks\AVFoundation.framework\AVFoundation.tbd (in iOS SDK 14.5) with your favorite text editor, you can see:
%
reexported-libraries:
- targets: [ armv7-ios, armv7s-ios ]
libraries: [ '/System/Library/Frameworks/AVFoundation.framework/Frameworks/AVFAudio.framework/AVFAudio' ]
- targets: [ armv7-ios, armv7s-ios, arm64-ios, arm64e-ios ]
libraries: [ '/System/Library/Frameworks/AVFAudio.framework/AVFAudio',
'/System/Library/PrivateFrameworks/AVFCapture.framework/AVFCapture',
'/System/Library/PrivateFrameworks/AVFCore.framework/AVFCore' ]
%
Bingo. A genuine cute Apple bug.
Actually I'm not quite sure of the best way to solve this problem. There are two cases:
- Either on iOS phones the AVFAudio framework is *really* located in /System/Library/Frameworks on the OS filesystem, and in which case we should correct the .tbd file to reflect that,
- Or in iOS devices the AVFAudio framework is *still* located in /System/Library/Frameworks/AVFoundation.framework/Frameworks as a sub-framework, and in which case we should move it back there in the SDK.
The thing is, what's built must reflect exactly the topology of what's available on an iOS system. So here's my advice to you: choose either method, and see if it crashes at runtime when you use functions that belong to this framework. If one method crashes, the right one is the other.
In either case, the iOS SDK 14.5 is wrong and should be fixed :-)
Have a nice day,
P.S. I will rename this thread to include "AVFAudio" in it. I hope you don't mind.
I noticed one thing more. This error happens because you're building for armv7. If you look in the reexported-libraries section of this framework's TBD file, you see that for arm64-ios, the path to the framework is correct.
So maybe you should just migrate your project to arm64 ?