xamarin / XamarinComponents

Plugins for Xamarin
MIT License
1.99k stars 695 forks source link

Error when building for iOS 13 device with Xamarin.iOS.SwiftRuntimeSupport package #817

Open iTwenty opened 4 years ago

iTwenty commented 4 years ago

Steps

  1. Create a fresh Xamarin.iOS app with deployment target iOS 10.0
  2. Add a dll for a native framework that is a mixed objc + swift (dll created using binding project)
  3. Add Xamarin.iOS.SwiftRuntimeSupport package since I need to support iOS < 12.2
  4. Build for a device running iOS 13.3.1

Expected

No build errors

Observed

_SRSCopySwiftDependencies build target fails with following error :

Target _SRSCopySwiftDependencies:
    Copying Swift Frameworks dependencies for bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/hsfwxam to the bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks folder.
    /Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign '389A22419DD482B8D8C4212A65E1C49F18797802' --scan-executable 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/hsfwxam' --scan-folder 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/' --scan-folder 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/PlugIns/' --platform 'iphoneos' --toolchain '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/' --resource-destination 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhone/Debug/device-builds/iphone9.3-13.3.1/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhone/Debug/device-builds/iphone9.3-13.3.1/SwiftStdLibToolInputDependencies.dep' --source-libraries '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos'
    Copying libswiftFoundation.dylib from /Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos to bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/
      /usr/bin/xcrun '--toolchain' '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain' 'bitcode_strip' '/Applications/Xcode_11_3_1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos/libswiftFoundation.dylib' '-r' '-o' 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/libswiftFoundation.dylib'
    xcrun : error : unable to find utility "bitcode_strip", not a developer tool or in PATH
    EXEC : *** error : Couldn't copy and strip bitcode /Applications/Xcode_11_3_1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos/libswiftFoundation.dylib to bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/libswiftFoundation.dylib: bitcode_strip failed with exit code 72
    /Users/jaydeep/.nuget/packages/xamarin.ios.swiftruntimesupport/0.2.0/buildTransitive/Xamarin.iOS.SwiftRuntimeSupport.targets(19,9): error MSB3073: The command "/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign '389A22419DD482B8D8C4212A65E1C49F18797802' --scan-executable 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/hsfwxam' --scan-folder 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/' --scan-folder 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/PlugIns/' --platform 'iphoneos' --toolchain '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/' --resource-destination 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhone/Debug/device-builds/iphone9.3-13.3.1/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhone/Debug/device-builds/iphone9.3-13.3.1/SwiftStdLibToolInputDependencies.dep' --source-libraries '/Applications/Xcode_11_3_1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos'" exited with code 1.
Done building target "_SRSCopySwiftDependencies" in project "hsfwxam.csproj" -- FAILED.

The interesting part seems to be this :

    xcrun : error : unable to find utility "bitcode_strip", not a developer tool or in PATH
    EXEC : *** error : Couldn't copy and strip bitcode /Applications/Xcode_11_3_1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos/libswiftFoundation.dylib to bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/hsfwxam.app/Frameworks/libswiftFoundation.dylib: bitcode_strip failed with exit code 72

Note that the build succeeds for an iOS 12.0 simulator. Haven't tested on any other device.

ahsurg commented 4 years ago

I am facing the same issue. iOS <13 devices build with no errors, but iOS 13+, gives me this error. I found this happens if I change the name of Xcode installation in Visual Studio settings to anything other than /Applications/Xcode.app. I had my Xcode install pointed to /Applications/Xcode11.app. Changing the name to Xcode.app solves the build error for me. I also discovered that if I run the failing command

/usr/bin/xcrun '--toolchain' '/Applications/Xcode11.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain' 'bitcode_strip' '/Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos/libswiftFoundation.dylib' '-r' '-o' 'bin/iPhone/Debug/device-builds/iphone9.3-13.3.1/ClientXamarin.app/Frameworks/libswiftFoundation.dylib'

in my terminal, then it succeeds. So, perhaps it has got something to do with the environment in which the command is executed in Xamarin build process?

I spent a good couple of days on this problem. This definitely needs to be looked into.

iTwenty commented 4 years ago

Changing the name to Xcode.app from Xcode_11_3_1.app, and then changing the VS settings to point to Xcode.app works for me as well. Not an ideal solution though IMO.

uwantfries commented 3 years ago

I can get further than this but store submission fails processing with an email

Dear Developer,

We identified one or more issues with a recent delivery for your app, "XXXX" YYYYY. Please correct the following issues, then upload again.

ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.

Best regards,

The App Store Team <<<<<

I got round this by creating the release archive then:

We are moving to a devops build system so some sort of fix would be good.

tpetersheimpk commented 3 years ago

Hopefully not off topic. I am getting an error from the same command but the output is just exited with code 255

1>(_SRSCopySwiftDependencies target) -> 
1>  C:\Users\[user]\.nuget\packages\xamarin.ios.swiftruntimesupport\0.2.0\buildTransitive\Xamarin.iOS.SwiftRuntimeSupport.targets(19,9): error MSB3073: The command "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign '-' --scan-executable 'bin/iPhoneSimulator/Debug/intelliSPEC.Forms.iOS.app/intelliSPEC.Forms.iOS' --scan-folder 'bin/iPhoneSimulator/Debug/intelliSPEC.Forms.iOS.app/Frameworks/' --scan-folder 'bin/iPhoneSimulator/Debug/intelliSPEC.Forms.iOS.app/PlugIns/' --platform 'iphonesimulator' --toolchain '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhoneSimulator/Debug/intelliSPEC.Forms.iOS.app/Frameworks/' --resource-destination 'bin/iPhoneSimulator/Debug/intelliSPEC.Forms.iOS.app/' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhoneSimulator/Debug/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhoneSimulator/Debug/SwiftStdLibToolInputDependencies.dep' --source-libraries '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator'" exited with code 255.
jkandiko commented 3 years ago

Getting a similar error as @tpetersheimpk The command "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign 'SIGNATURE' --scan-executable 'bin/iPhone/Debug/device-builds/iphone12.1-14.6/App8.iOS.app/App8.iOS' --scan-folder 'bin/iPhone/Debug/device-builds/iphone12.1-14.6/App8.iOS.app/Frameworks/' --scan-folder 'bin/iPhone/Debug/device-builds/iphone12.1-14.6/App8.iOS.app/PlugIns/' --platform 'iphoneos' --toolchain '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhone/Debug/device-builds/iphone12.1-14.6/App8.iOS.app/Frameworks/' --resource-destination 'bin/iPhone/Debug/device-builds/iphone12.1-14.6/App8.iOS.app/' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhone/Debug/device-builds/iphone12.1-14.6/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhone/Debug/device-builds/iphone12.1-14.6/SwiftStdLibToolInputDependencies.dep' --source-libraries '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos'" exited with code 255 . Any updates on how to get it to compile and deploy?

Pandu-V commented 3 years ago

I'm facing the following while pair to MAC from Windows error MSB3073: The command "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --scan-executable 'bin/iPhoneSimulator/Debug/../..S' --scan-folder 'bin/iPhoneSimulator/Debug/../Frameworks/' --scan-folder 'bin/iPhoneSimulator/Debug/../PlugIns/' --platform 'iphonesimulator' --toolchain '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhoneSimulator/Debug/../Frameworks/' --resource-destination 'bin/iPhoneSimulator/Debug//' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhoneSimulator/Debug/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhoneSimulator/Debug/SwiftStdLibToolInputDependencies.dep' --source-libraries '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator'" exited with code 255.

Tim-Rossiter commented 3 years ago

also getting a weird error. I already updated xcode, visual studio, xamarin versions

Severity Code Description Project File Line Suppression State Error The command "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign '-' --scan-executable 'bin/iPhoneSimulator/Debug/Kickback2020.iOS.app/Kickback2020.iOS' --scan-folder 'bin/iPhoneSimulator/Debug/Kickback2020.iOS.app/Frameworks/' --scan-folder 'bin/iPhoneSimulator/Debug/Kickback2020.iOS.app/PlugIns/' --platform 'iphonesimulator' --toolchain '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhoneSimulator/Debug/Kickback2020.iOS.app/Frameworks/' --resource-destination 'bin/iPhoneSimulator/Debug/Kickback2020.iOS.app/' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhoneSimulator/Debug/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhoneSimulator/Debug/SwiftStdLibToolInputDependencies.dep' --source-libraries '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphonesimulator'" exited with code 255. Kickback2020.iOS