Swift dylibs not copied to my bundle

I have a Swift 3 based project (started under Xcode 8b1). It's been working fine under betas 1 and 2, but under 3 it's crashing at launch:


dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib


Looking at the bundle, I see the /Frameworks folder is empty. Why won't Xcode copy the default Swift dlybs to my app anymore? I've not changed any settings since b2 (where they were all copied fine.


Ben

Replies

I am seeing this same problem as well. All was fine in b2, but attempting to build today presented this. My project is a mix of Swift 2.3 and ObjC.

After more testing, it seems that taking a new vanilla single-view-controller project and simply adding an externally built library causes the problem to manifest itself. Using an internal library doesn't.


Ben

I get this rather anonymous error in the `Copy Swift standard libraries` build step.


Effective srcDirs: {(
    <DVTFilePath:0x7fe89026dd50:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos'>,
    <DVTFilePath:0x7fe890bf52c0:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos'>
)}
Effective Swift version: { arm64: 4; armv7: 4; i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreGraphics.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreGraphics.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreImage.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreImage.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftDarwin.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftDarwin.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftDispatch.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftDispatch.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftFoundation.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftFoundation.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftObjectiveC.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftObjectiveC.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftUIKit.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftUIKit.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftsimd.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftsimd.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftAVFoundation.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftAVFoundation.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreAudio.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreAudio.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreLocation.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreLocation.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreMedia.dylib { arm64: 4; armv7: 4; armv7s: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos/libswiftCoreMedia.dylib { arm64: 3; armv7: 3; armv7s: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftSwiftOnoneSupport.dylib { arm64: 4; armv7: 4; armv7s: 4 }

I've found that if you manually add the libraries in, it does work. Not an ideal solution, of course.


Ben

Did you add Swift or Objective-C framework? I have this problem with my app which has mix of Swift 3.0 and Objective-C framework build with Carthage. I tried vanilla project with Swift framework and it worked but after I added Objective-C framework in project Swift frameworks were missing from the bundle.

There's a workaround here: https://github.com/Carthage/Carthage/issues/1394#issuecomment-233958908


Seems to be an issue with beta 3.

I have made a script which solves this problem on iOS:

https://gist.github.com/madhavajay/39ff8bfee92e7cd97ea4270b8c99b3bc


Theres also a conversation here:

https://github.com/Carthage/Carthage/issues/1394


If anyone can figure out how to get it working for watchOS, please tell me. 🙂


Madhava

After more exploration, it seems that it's related to using 'fat' frameworks (those including both arm and x86 code). If I swap out my fat frameworks for platform-specific ones, it works.


Ben

Any news regarding this? I'll try to create a project and submit a bug to Apple. Please let us know if anyone already did so we can duplicate it.

I've tried creating a project, however from what I can tell, the problem is only manifesting when I try and add a 'fat' framework. I haven't yet created a project along with a fat-framework generator.


Ben

Here's my radar: http://www.openradar.me/radar?id=4957112975228928

It's a known issue.

It seems XCode Beta 3 is not using swift-stdlib-tool (found in the XCode toolchain), but some "builtin-swiftStdLibTool" which causes the problem.

If you add a build script which forces the usage of swift-stdlib-tool, it works at least for IOS.

My message with links is being moderated but if you want the answer you can google for:

github carthage issues 1394 abi mismatch.


Would be great if some other people could verify this for me and post in the Carthage issues page or here about it.


I'm about to try figure out watchOS now which is the last bit of the puzzle I need to keep working.

Would you mind detailing how you do that exactly? What do I put into the build script?

Thank you so much! Your gist solves the problem ✅


Since I can't post a link to your gist 😕 let's see if this works gist user: madhavajay, gist ID: 39ff8bfee92e7cd97ea4270b8c99b3bc