xamarin / XamarinComponents

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

Adding a reference to Xamarin.iOS.SwiftRuntimeSupport breaks build #1198

Open jkandiko opened 3 years ago

jkandiko commented 3 years ago

Create a new Xamarin forms project. Build and deploy it to iOS 14.5. Everything works. Add the Nuget package Xamarin.iOS.SwiftRuntimeSupport and I receive the following error:

Error 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 'XXXXXX' --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. App8.iOS C:\Users\xxx.nuget\packages\xamarin.ios.swiftruntimesupport\0.2.0\buildTransitive\Xamarin.iOS.SwiftRuntimeSupport.targets 19

How do I investigate what code 255 is? If I remove the package, everything builds and deploys normally.

tompi commented 3 years ago

Not sure if its the same problem, but this package has been giving me grief as well lately... Whenever I try to Archive for publishing, I get the error "ditto exited with code 1" and this in the log:

Target _SRSCopySwiftSupport:
    Copying SwiftSupport folder from obj/Release/SwiftSupport to /SwiftSupport folder.
    /usr/bin/ditto obj/Release/SwiftSupport /SwiftSupport 
    ditto: Cannot get the real path for source 'obj/Release/SwiftSupport'
    /Users/tompi/.nuget/packages/xamarin.ios.swiftruntimesupport/0.2.0/buildTransitive/Xamarin.iOS.SwiftRuntimeSupport.targets(25,9): error MSB6006: "ditto" exited with code 1.
mrrenaud commented 1 year ago

Not sure if its the same problem, but this package has been giving me grief as well lately... Whenever I try to Archive for publishing, I get the error "ditto exited with code 1" and this in the log:

Target _SRSCopySwiftSupport:
    Copying SwiftSupport folder from obj/Release/SwiftSupport to /SwiftSupport folder.
    /usr/bin/ditto obj/Release/SwiftSupport /SwiftSupport 
    ditto: Cannot get the real path for source 'obj/Release/SwiftSupport'
    /Users/tompi/.nuget/packages/xamarin.ios.swiftruntimesupport/0.2.0/buildTransitive/Xamarin.iOS.SwiftRuntimeSupport.targets(25,9): error MSB6006: "ditto" exited with code 1.

Having the same issue here with version 0.2.1.

@tompi did you find a solution?

Totonti commented 1 year ago

Hi, Having the same issue here with version 0.2.1.

please, has anyone found a solution?

NikolayGenov commented 1 year ago

@tompi @Totonti @mrrenaud Have you found a workaround for that?

albertb22 commented 12 months ago

Does anyone found a solution?

rolfbjarne commented 5 months ago

Adding this to your csproj might fix it:

<Target Name="_SRSCopySwiftSupport" />

Note that you'll also have to make sure the min iOS version (the SupportedOSPlatformVersion property in the csproj) is at least 12.2.

albertb22 commented 5 months ago

I think I fixed this in PR #1431

WanftMoon commented 5 months ago

Issue present in MacOS sonoma with the latest VS and xcode 15

  Target _SRSCopySwiftSupport:
        Copying SwiftSupport folder from obj/Release/xamarin.ios10/SwiftSupport to /SwiftSupport folder.
        /usr/bin/ditto /obj/Release/xamarin.ios10/SwiftSupport /SwiftSupport 
        ditto: Cannot get the real path for source 'obj/Release/xamarin.ios10/SwiftSupport'
        /.nuget/packages/xamarin.ios.swiftruntimesupport/0.2.1/buildTransitive/Xamarin.iOS.SwiftRuntimeSupport.targets(25,9): error MSB6006: "ditto" exited with code 1.

@tompi @Totonti @mrrenaud @rolfbjarne

any insights on this? (the path obj/Release/xamarin.ios10/SwiftSupport doesn't really exists) and i've looked in all obj/ in the solution

@albertb22 Any idea when Xamarin.iOS.swiftruntimesupport 0.2.2 will be available?

rolfbjarne commented 5 months ago

@WanftMoon did you try the workaround here: https://github.com/xamarin/XamarinComponents/issues/1198#issuecomment-1886427642?

WanftMoon commented 5 months ago

@WanftMoon did you try the workaround here: #1198 (comment)?

Yeah, tried in the native binding, then the lib wrapping the native binding and then in the iOS project, then tried all of the 3.

WanftMoon commented 5 months ago

@WanftMoon did you try the workaround here: #1198 (comment)?

@rolfbjarne Got it working!!

I had the swift package in the native bidings, so i just removed from it and added it to the target iOS project. Then VSMac finally got to archive it.

But if I may question, the <Target Name="_SRSCopySwiftSupport" /> will not copy the swift libs. Is there any point in adding the Xamarin.iOS.swiftruntimesupport nuget after iOS 12.2, or still needed for the build?

rolfbjarne commented 5 months ago

Is there any point in adding the Xamarin.iOS.swiftruntimesupport nuget after iOS 12.2, or still needed for the build?

It looks like it's not needed if you set the deployment target to at least iOS 12.2, but I might be wrong. Note that you might also get the reference through another NuGet package, so it might not be that easy to remove the reference.