Embedding frameworks with fat binaries will prevent Swift libraries to be embedded.

Originator:lucv926
Number:rdar://27459058 Date Originated:20-Jul-2016 06:32 PM
Status:Duplicate Resolved:NO
Product:Developer Tools Product Version:Xcode 8 B3 8S174q
Classification:Serious Bug Reproducible:Always
 
Summary:
Since Xcode 8 Beta 3, embedding some frameworks will cause Xcode from not embedding Swift libraries.

Steps to Reproduce:
- Open the attached project
- Embed any of the frameworks under the "Embed to show bug" group
- Clean and compile
- Open Finder to the location of the .app
- Right-click to show content and go to Frameworks


Expected Results:
Swift libraries should be included.

Actual Results:
Swift libraries are missing and Xcode outputs this:

CopySwiftLibs /Users/lucvandal/Library/Developer/Xcode/DerivedData/dylibs-byridmbqtcupvddpkmyklvsjqmvw/Build/Products/Debug-iphonesimulator/dylibs.app
    cd "/Users/lucvandal/Downloads/dylib issue/dylibs"
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer
    export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    export SDKROOT=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk
    export TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault
    builtin-swiftStdLibTool --copy --verbose --sign - --scan-executable /Users/lucvandal/Library/Developer/Xcode/DerivedData/dylibs-byridmbqtcupvddpkmyklvsjqmvw/Build/Products/Debug-iphonesimulator/dylibs.app/dylibs --scan-folder /Users/lucvandal/Library/Developer/Xcode/DerivedData/dylibs-byridmbqtcupvddpkmyklvsjqmvw/Build/Products/Debug-iphonesimulator/dylibs.app/Frameworks --scan-folder /Users/lucvandal/Library/Developer/Xcode/DerivedData/dylibs-byridmbqtcupvddpkmyklvsjqmvw/Build/Products/Debug-iphonesimulator/dylibs.app/PlugIns --scan-folder /Users/lucvandal/Downloads/dylib\ issue/Vendor/Carthage/Build/iOS/OnePasswordExtension.framework --scan-folder /Users/lucvandal/Downloads/dylib\ issue/Vendor/Carthage/Build/iOS/SSKeychain.framework --scan-folder /Users/lucvandal/Downloads/dylib\ issue/Vendor/Carthage/Build/iOS/Branch.framework --scan-folder /Users/lucvandal/Downloads/dylib\ issue/Vendor/Carthage/Build/iOS/Reachability.framework --platform iphonesimulator --toolchain /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --toolchain /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain --toolchain /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --destination /Users/lucvandal/Library/Developer/Xcode/DerivedData/dylibs-byridmbqtcupvddpkmyklvsjqmvw/Build/Products/Debug-iphonesimulator/dylibs.app/Frameworks --strip-bitcode --resource-destination /Users/lucvandal/Library/Developer/Xcode/DerivedData/dylibs-byridmbqtcupvddpkmyklvsjqmvw/Build/Products/Debug-iphonesimulator/dylibs.app --resource-library libswiftRemoteMirror.dylib

Effective srcDirs: {(
    <DVTFilePath:0x6080002a7740:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator'>,
    <DVTFilePath:0x6000006a3f60:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator'>
)}
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/iphonesimulator/libswiftCore.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCore.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCoreGraphics.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCoreGraphics.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCoreImage.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCoreImage.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftDarwin.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftDarwin.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftDispatch.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftDispatch.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftFoundation.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftFoundation.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftObjectiveC.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftObjectiveC.dylib { i386: 3; x86_64: 3 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftUIKit.dylib { i386: 4; x86_64: 4 }
Found library with mismatched Swift ABI: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator/libswiftUIKit.dylib { i386: 3; x86_64: 3 }

Version:
Xcode 8 beta 3 8S174q

Notes:
I've included the frameworks source code so you can see what project settings are causing this issue.

If this the expected behaviour, it wasn't specified in the latest Xcode 8 B3 release notes.

Also, see: 

https://forums.developer.apple.com/message/155480#155480
https://forums.developer.apple.com/thread/52139

Configuration:
N/A

This never was an issue with Xcode 7 or previous Xcode 8 betas.

Comments

Temporary Solution

I have solved this issue for iOS Apps currently using the script detailed here: https://gist.github.com/madhavajay/39ff8bfee92e7cd97ea4270b8c99b3bc

Theres a discussion here about it: https://github.com/Carthage/Carthage/issues/1394

It seems the builtin-swiftStdLibTool is broken, or being stricter in a way which doesnt matter to the current iOS 10 or watchOS 3. I assume all this applies to tvOS as well but no one has posted about it yet.

I still can't figure out why my watchOS app wont load (it times out), but a brand new test watch app seems okay, so still debugging that part. But if I look at both the App and the Extension build steps they have the same: "Mismatched Swift ABI" error.

I have tried adding the same script to both the App and Extension build phases but its still timing out, so theres another problem....


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!