Xcode 15: "Cycle inside ...; building could produce unreliable results" due to DSTROOT=/

Offering this here for those who may run into the same issue... There is more than one reason you may get the following error message when attempting to build your targets:

Cycle inside ...; building could produce unreliable results

But if you just switched to Xcode 15 and you are currently customizing DSTROOT to set the root install location for the deliverables (app, bundle, etc) built by your Target, Xcode 15 will refuse to build any target with dependencies on other targets that use the same underlying configuration. There is obviously no real cycle: Xcode 15 is just confused by both targets sharing the same DSTROOT. For example, if you set up your projects with:

DSTROOT=/
INSTALL_PATH=/Applications

(notice that DSTROOT=/ is even mentioned in the docs)

Xcode will wrongfully detect a circular dependency as both targets share the build destination and thus refuse to build. The solution is to not customize DSTROOT, thus allowing it to have a directory name that is target-dependent and thus fairly immune to collisions. Instead, customize the INSTALL_ROOT setting. While this setting does not appear in the Build Phases tab, it defaults to reusing the DSTROOT value. If you set it explicitly, it allows DSTROOT to remain for other purposes, while using the value of INSTALL_ROOT to deploy your deliverables:

INSTALL_ROOT=/
INSTALL_PATH=/Applications

This allows the build system to proceed without errors.

Answered by .jeroen. in 755002022

Update: we managed to fix the issue on our end by moving the 'Embed Frameworks' build phase above the 'Run script' build phase(s).

We're seeing the same error, but we don't change DSTROOT. We have 2 frameworks in our workspace, where framework a links to and depends on framework b (Always Used / Do Not Embed) and the host app depends and embeds and signs both framework a and b (Always Used / Embed & Sign). This works fine in Xcode 14.3.1 but causes the Cycle inside ...; building could produce unreliable results error in Xcode 15.0 beta 1.

Accepted Answer

Update: we managed to fix the issue on our end by moving the 'Embed Frameworks' build phase above the 'Run script' build phase(s).

77

I had this issue too. I had two interrelated dependencies. One as a CocoaPod and one as a Swift Package. Only one was available as a SPM (don't ask me why lol). I moved both to use as CocoaPods and the issue went away. Out of my wheelhouse to know exactly why. Sorry.

Same issue. XCode 15 beta 2

Same issue in Xcode 15 beta 3

Same issue. XCode 15.0 beta 4 (15A5195m)

Same issue here. I have tried reading the error message and moving the (in my case crashlytics) run scripts around with no avail.

My issue is that I also have a live activity extension that has embedded frameworks that cannot be above or below crashlytics.

I'm REALLY hoping someone at apple has seen this thread & are working to fix this for the GM or Beta 5.

I had this issue when trying to build an iOS app with a Widget Extension. I fixed it by moving "Embed Foundation Extensions" build phase above the "[CP] Embed Pods Frameworks"

if you have Crashlytics in your project, there's this discussion in the firebase-ios-sdk repo:

https://github.com/firebase/firebase-ios-sdk/issues/11471

Workaround fix that worked for some people including myself:

The issue generally can be reproduced if you have an input file in run script from build output file and a binary SPM package in your program. Indeed both AWS and cardIO are binary SPM. We will make a feedback to Apple as well. Meanwhile to unblock you from build, you can shorten the dSYM path to ${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF.

Link to answer

As always, double check that there are no undesirable side effects with the Crashlytics install, depending on your priorities and requirements.

issue still exists in final Xcode 15

I was able to fix this by moving the Embed App Extensions, Embed Frameworks, and Embed Pods Frameworks to be performed before the Run Script build phase. I had just run into the issue in the Xcode 15.0 update and am building with Flutter w/ flavors.

27

Updating to Cocoapods 1.13.0 fixed the issue for me and no need for this anymore: https://stackoverflow.com/questions/77136958/flutter-xcode-15-error-xcode-dt-toolchain-dir-cannot-be-used-to-evaluate-libr

Recently updated my Xcode to 15.0 public release version and getting the following error.

` error: Cycle in dependencies detected, but could not be parsed. Please file a bug report with the build transcript and how to reproduce the cycle if possible.

Raw dependency cycle trace:

target: ->

node: ->

command: ->

node: /Users/user/Library/Developer/Xcode/DerivedData/MyProject-fpqiiiuwahekjpfiutbzqrxozzlh/Build/Intermediates.noindex/EagerLinkingTBDs/Debug ->

command: P0:::CreateBuildDirectory /Users/user/Library/Developer/Xcode/DerivedData/MyProject-fpqiiiuwahekjpfiutbzqrxozzlh/Build/Intermediates.noindex/EagerLinkingTBDs/Debug ->

node: /Users/user/Library/Developer/Xcode/DerivedData/MyProject-fpqiiiuwahekjpfiutbzqrxozzlh/Build/Intermediates.noindex ->

command: P0:::CreateBuildDirectory /Users/user/Library/Developer/Xcode/DerivedData/MyProject-fpqiiiuwahekjpfiutbzqrxozzlh/Build/Intermediates.noindex ->

CYCLE POINT ->

node: / ->

directoryTreeSignature: ->

directoryContents: / ->

node: /`

Below is the Build phases for my project.

Please let me know how to fix this.

This order works for me, I have notifications extension

Xcode 15: "Cycle inside ...; building could produce unreliable results" due to DSTROOT=/
 
 
Q