michaeleisel / zld

A faster version of Apple's linker
MIT License
1.19k stars 50 forks source link

Autolinking seems to fail for libswiftAVFoundation #61

Closed michaeleisel closed 4 years ago

michaeleisel commented 4 years ago

On Xcode 12, when -libswiftAVFoundation is auto-linked from an object file for the simulator, it's successfully able to find the library for ld but not for zld. the system library search paths for both are:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/lib/swift
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk/usr/lib

Searching for this library, we see:

$ find . -name '*wiftAVFound*'
Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/appletvsimulator/libswiftAVFoundation.dylib
Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/appletvos/libswiftAVFoundation.dylib
Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/macosx/libswiftAVFoundation.dylib
Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos/libswiftAVFoundation.dylib
Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator/libswiftAVFoundation.dylib
Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/swift/libswiftAVFoundation.tbd
Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib/swift/libswiftAVFoundation.tbd
Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib/swift/libswiftAVFoundation.tbd
Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/swift/libswiftAVFoundation.tbd

So, there's a matching .tbd file for each platform besides the simulator, and so iPhoneOS on the other hand works. but it's unclear how newer ld deals with this for libswiftAVFoundation without any issues

michaeleisel commented 4 years ago

fixed by https://github.com/michaeleisel/zld/pull/63