PTCInc / vuforia-engine

Bug and feedback issue tracker for the Vuforia Engine SDK
https://developer.vuforia.com
20 stars 0 forks source link

iOS Builds fail due to "unexpected duplicate tasks" #75

Closed mrcarriere closed 11 months ago

mrcarriere commented 12 months ago

Summarize the bug: We're seeing an immediate build failure in Xcode after opening the exported Xcode Project from an iOS build in Unity.

Observed problem Xcode indicates that there are "Unexpected duplicate tasks" and provides these two messages:

Target 'Unity-iPhone' (project 'Unity-iPhone') has copy command from '/Users/michael/vc/XXX/Builds/iOS/XXXXcode/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS/UnityDriver.framework' to '/Users/michael/Library/Developer/Xcode/DerivedData/Unity-iPhone-eviafjkjongbbigjhjevcxprpjsg/Build/Products/ReleaseForRunning-iphoneos/XXX.app/Frameworks/UnityDriver.framework'

Target 'Unity-iPhone' (project 'Unity-iPhone') has copy command from '/Users/michael/vc/XXX/Builds/iOS/XXXXcode/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS/UnityDriver.framework' to '/Users/michael/Library/Developer/Xcode/DerivedData/Unity-iPhone-eviafjkjongbbigjhjevcxprpjsg/Build/Products/ReleaseForRunning-iphoneos/XXX.app/Frameworks/UnityDriver.framework'

Expected result Build succeeds.

Reproducible steps

Affected Vuforia Engine version: v10.19.3

Affected platform:

Workaround

It seems like the only workaround right now to successfully build is to manually delete the duplicate "Embed Framework" step in the Build Phases, but doing this causes a crash on running the build. (see comment below)

Additional comments

Also posted on SO.

mrcarriere commented 12 months ago

That workaround does not seem to be an ideal fix -- while it does allow the build to succeed, the game will crash at launch with this error:

Error loading /var/containers/Bundle/Application/62B19EEB-3073-4F90-AE92-E22252170EBC/XXX.app/Frameworks/UnityFramework.framework/UnityFramework (138):  dlopen(/var/containers/Bundle/Application/62B19EEB-3073-4F90-AE92-E22252170EBC/XXX.app/Frameworks/UnityFramework.framework/UnityFramework, 0x0109): Library not loaded: @rpath/VuforiaEngine.framework/VuforiaEngine
  Referenced from: <4F4B84A0-EB3E-3DBD-AF50-CFFD8782FBC8> /private/var/containers/Bundle/Application/62B19EEB-3073-4F90-AE92-E22252170EBC/XXX.app/Frameworks/UnityFramework.framework/UnityFramework
  Reason: tried: '/private/var/containers/Bundle/Application/62B19EEB-3073-4F90-AE92-E22252170EBC/XXX.app/Frameworks/VuforiaEngine.framework/VuforiaEngine' (no such file), '/private/var/containers/Bundle/Application/62B19EEB-3073-4F90-AE92-E22252170EBC/XXX.app/Frameworks/VuforiaEngine.framework/VuforiaEngine' (no such file), '/private/var/containers/Bundle/Application/62B19EEB-3073-4F90-AE92-E22252170EBC/XXX.app/Frameworks/VuforiaEngine.framework/VuforiaEngine' (no such file)
ptc-pscheper commented 12 months ago

Hi there, can you reproduce this issue with our Core Samples? If this error happens out of nowhere it sounds like a specific Xcode issue. Without reproducible steps we cannot try to solve this issue.

onPlex commented 11 months ago

having same issue , happened after vuforia package update v10.18.x -> v10.19.3

Xcode 15.0.1 Unity 2022.3.14f1

ptc-pscheper commented 11 months ago

@onPlex, can you reproduce this issue with our Core Samples? Without reproducible steps we cannot try to solve this issue.

arnaudjopart commented 11 months ago

Hi @ptc-pscheper . Thanks for the support. No need to use the Core Samples to reproduce the issue. I just have to import the Vuforia Package (10.18 OR 10.19) and build a simple Unity project containing a single scene with an ARCamera. In xCode 15, I get an immediate build fail with the following message:

Unexpected duplicate tasks:

Target 'Unity-iPhone' (project 'Unity-iPhone') has copy command from '/Users/arnaudjopart/Documents/dev/Vuforia-1018/Builds/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS/UnityDriver.framework' to '/Users/arnaudjopart/Library/Developer/Xcode/DerivedData/Unity-iPhone-gaqsxwkqatdfhobzwqevzzrglprn/Build/Products/ReleaseForRunning-iphoneos/Vuforia-1018.app/Frameworks/UnityDriver.framework'

I do see multiple embed Frameworks in the build phases:

image

This happened to me after upgrading macOS to Sonoma and xCode to 15. Before this upgrade, I had no problem running my app. Now either with Vuforia 10.18 and 10.19, I get the build failure.

It did not occure with Vuforia 10.18 on previous version of macOS and xCode

Concerning the specs:

Hope this can help solve this very annoying bug.

Cheers,

Arnaud

ptc-pscheper commented 11 months ago

Appreciate your extra input. I've forwarded this issue to your team for further investigation and will reach back with any feedback.

ptc-pmessenger commented 11 months ago

@arnaudjopart @mrcarriere while we're investigating the root cause, could you please try not using "build and run" (or cmd+ B) but "build" and choose the "replace" option, which deletes the XCode project before regenerating. This should provide a workaround for the time being.

arnaudjopart commented 11 months ago

@ptc-pscheper Thanks for the feedback. That, my dear, was my workaround before this bug. When happily working on Vuforia 10.18 and macOS Ventura, I indeed observed that I needed to "Replace" the build when exporting a XCode project, instead of simply "Append". But sadly, that's not the solution anymore. A "replace" does not apparently solve this issue. I will asap try to revert to previous macOS (and corresponding xcode) and try build the app with Vuforia 10.19. It's gonna be fun ;-)

mrcarriere commented 11 months ago

@ptc-pmessenger I'm in the same boat as @arnaudjopart: this is the result of both local builds and a build server building to completely new folders, and with completely rebuilt project libraries.

Unfortunately we don't have the ability (or time) to downgrade our OS to resolve this issue.

ptc-epassaro commented 11 months ago

Hello @mrcarriere, @arnaudjopart, we are still looking for the root cause of this issue and are in contact with Unity to get this fixed as soon as possible, as they already received similar reports and are reviewing a fix for the next patch release. You can follow the progress on Unity's Issue Tracker

In the meantime, we believe to have found a workaround for at least part of the problem and would be great if you could try it and let us know if you see any improvement.

Start by downloading this archive, then follow these steps:

As you already know, building with "File" > "Build And Run" option in the Editor or the corresponding CMD+B keyboard shortcut may cause the issue to reappear.

We will keep you updated on this issue and I hope the workaround improves the situation for the time being.

AndrewMarcHarris commented 11 months ago

Adding this code to the project allowed the build to complete but the app just crashes on launch

ptc-epassaro commented 11 months ago

It appears that there could be multiple issues at play here. Would it be possible for you to send us the crash log? It would be very helpful for us to keep investigating this.

ptc-epassaro commented 11 months ago

Hello everyone, Unity 2022.3.16f1 was released yesterday and it should contain a fix for the duplicate embedded frameworks issue. Could you please give it a try and let us know if the issue still occurs?

StathisGeorgiou commented 11 months ago

Hello @ptc-epassaro problem solved with Unity 2022.3.16f1

specs: Unity 2022.3.16f1 macOS Sonoma 14.2.1 xCode 15.1 (15C65) Vuforia 10.19.3

AndrewMarcHarris commented 11 months ago

Yep want to confirm the new unity version works with cloud build Unity 2022.3.16f1 macOS Ventura xCode 14.3.1 Vuforia 10.13.3 Thanks for all the updates in this thread everyone.

mrcarriere commented 11 months ago

@ptc-epassaro Checking in here.

Builds succeeded on my local machine and our build machine.

Unity 2022.3.16f1 Vuforia 10.19.3 Xcode 15.1 macOS 14.1.2 (Intel) / 14.2 (Apple Silicon)

Thanks for keeping us informed!

mrcarriere commented 11 months ago

Solved in 2022.3.16f1.

Available here: https://unity.com/releases/editor/qa/lts-releases and via Unity Hub: unityhub://2022.3.16f1/d2c21f0ef2f1

arnaudjopart commented 11 months ago

@ptc-epassaro

Just for confirmation, successful build and deployment on : Unity 2022.3.16f1 macOS Sonoma 14.2.1 xCode 15.1 (15C65) Vuforia 10.18.4 and 10.19.3

Congratulations for your quick reaction and dedication to solve this problem.