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.

  • As an add-on to the accepted response: for Flutter projects a cycle like this may appear when adding an application extension to the Flutter App. That can be resolved by moving the "Embed Foundation frameworks"-Phase in front of the "Thin binary"-Phase for the main application (i.e. "Runner).

  • The INSTALL_ROOT setting is what worked for me.

  • Where can i find the INSTALL_ROOT setting and set it explicitly ?

Accepted Reply

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

  • not work for me.

  • Thanks for sharing this. We had the same issue. On a whim, I decided not to dig into it at all, but just to move our "Embed Frameworks" build phase above some run script ones we had, and it solved it. Thanks!

  • its worked. I moved the Run script at last in the build phase and excluded the arm64 arch for the simulator works fine.

Replies

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.

  • Which one of your targets fail? Is it the app? Do you have explicit dependencies on both frameworks in the app target? Does it make any difference if you turn off the Find Implicity Dependencies option under your Scheme > Build settings?

  • @.jeroen. any solution did you found?

Add a Comment

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

  • not work for me.

  • Thanks for sharing this. We had the same issue. On a whim, I decided not to dig into it at all, but just to move our "Embed Frameworks" build phase above some run script ones we had, and it solved it. Thanks!

  • its worked. I moved the Run script at last in the build phase and excluded the arm64 arch for the simulator works fine.

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"

  • It worked for 15.0 beta 5, with RN 0.69.*

  • This worked for me. Thanks.

  • I moved "Embed Foundation Extensions" above "Run Scripts", and it worked for Xcode 15.0.1. Thanks.

Add a Comment

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.

  • I see this issue with Xcode beta 5. My application is native iOS app. It compiles well with Xcode 14 version. I tried above mentioned suggestions but it didn't help.

Add a Comment

issue still exists in final Xcode 15

  • This is worked for me thanks a lot

    Target DependenciesRun Build Tool Plus-ins[CP] Check Pods Manifest.lock

    4. Embed Frameworks 5. Embed Foundation Extensions 6. [CP] Embed Pods Frameworks 7. Run Script 8. Compile Sources 9. Link Binary With Libraries 10. Copy Bundle Resources 11. Thin Binary its my sorting build phases

Add a Comment

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.

  • This worked for me thanks

  • Didn't work for me.

  • Didn't work for me too

This worked for me when everything else failed

https://stackoverflow.com/questions/77136958/flutter-xcode-15-error-xcode-dt-toolchain-dir-cannot-be-used-to-evaluate-libr

Add a Comment

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.

  • Did found a work around. Had to make DEPLOYMENT LOCATION to NO in Build Settings. This is not right solution but at least its building my project. Had to copy files manually to DEPLOYMENT LOCATION along with its library which is in Derived Data. If any one finds a proper solution, please update.

  • @chethancs This is the only thing that worked for me. Mine is a simple C++ project and there's no external dependency.

Add a Comment

This order works for me, I have notifications extension