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).

For me, we've got a widget extension which is in Embed Foundation Extensions. Putting this before Copy Bundle Resources solves our issue.

For me what worked: Updated cocoapods to the latest version (1.13.0), ran pod install, and moved all of my target's Run Script Phase build phases to the very bottom.

please follow the below image

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).

Moving the embed frameworks build phase above run script worked for me as well.

The INSTALL_ROOT setting is what worked for me.

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

I had issues with Copy Files. The solution was to remove it and to use a script to do the coping.

I'm in XCode 15 and Watch 10 OS, React Native 72 so my case, I did not have anything called "Embed Framework". I had a section in my iOS target Build Phases section called "Embed Watch Content".

Initially, "Embed watch content" was the LAST build phase of my main iOS Target. I did not have to touch anything in my Watch target build phases.

Follow the order of the picture below. You can literally just click and drag a build phase in the UI.

Before:

After:

I searched the entire internet and couldn't find a single resource pointing me to the INSTALL_ROOT settings, where can i find it???

Like FxFactory said (thank you dear stranger on the internet very much!), that solution worked! To set it:

  1. Build Settings
  2. Plus in top left
  3. User Defined Setting

Type INSTALL_ROOT in and for the field (should have a green outline), add "/"

And then I used this build phases (though I think it was setting):

It absolutely works for me... Thanks for providing so clearly the solution....

Add a user-defined setting called INSTALL_ROOT and set it to /.

iOS 17 I placed Embed App Extensions above Copy Bundle Resources and it worked

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