SourceKitten
SourceKitten copied to clipboard
Always link to Foundation
Otherwise, code that compiles and uses Foundation symbols but without import Foundation in the file would generate bad USRs (s:F10RealmSwift12migrateRealmERR vs s:F10RealmSwift12migrateRealmFTSS13encryptionKeyGSqCSo6NSData__GSqCSo7NSError_.
Aren't those files just incorrect if they don't import Foundation?
They'll still compile. I think Xcode implicitly links to Foundation, even though that's not exposed in the compiler flags when running xcodebuild
There’s a build flag for whether Xcode should link Foundation implicitly:
When linking a target using Objective-C code, implicitly link in Foundation (and if deploying back to an older OS) a backwards compatibility library to allow newer language features to run on an OS where the runtime support is not natively available. Most targets that use Objective-C will want to use this, although there are rare cases where a target may wish to opt out of this behavior. [
CLANG_LINK_OBJC_RUNTIME,-fobjc-link-runtime]
The setting is on by default.
Ah, thanks for sharing that @rastersize! Maybe it's as simple as adding -fobjc-link-runtime to compiler arguments.