Xcode 13.3 cycle in dependencies between targets

So using latest Xcode 13.3 on an Apple Silicon MacBook I get a compile error the 2nd time and every time there after stating 'cycle dependencies between targets'. So my App has a AppCoreLibrary we compile and it complains about this library and the App itself stating a cycle dependency exists. Only way to get it to compile again is to do a clean build and then it will compile the first time and that's it. This was never a problem in any prior Xcode release. Spent time trying to get around it, but haven't found a way yet. Seem's like it's yet another new Xcode bug introduced on this latest 13.3 build. Wondering if anyone else is seeing this too?

I faced same issue. moving Headers in Target's build phase of the failed framework before compile sources fixed the issue.

Example should look like:

Dependencies Headers Compile Sources Link Binary With Libraries Copy Bundle Resources

Google a programmatic cycle or cyclic dependency then see if the pattern exist in your code.

https://stackoverflow.com/questions/47872419/resolve-circular-dependency-in-swift

You can solve moving the Headers build phase on top of the Compile Sources.

Same issue for me with latest Xcode. I have Intel chip and no Headers

So verified the above fix moving the Headers file for my CoreLibrary Framework to the top of the Target in Build Phases fixed this issue. Thanks so much for the feedback!

I'm seeing the same issue, with a Unity-generated project. I don't think moving headers around in the project is a solution for Unity-generated projects, since the whole project gets regenerated every time I build. I can just do a "Clean Build Folder" and then it builds again without having to regenerate the whole project. I hope Apple fixes this issue, but I have low hopes that they're paying attention.

I have no Headers build phase in my project, however what solved the problem for me were these steps:

  1. Close Xcode
  2. Delete DerivedData folder
  3. Open Terminal and run defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1

Step 3 enables the new build system. Check the release notes for 13.3 for more information.

Same problem here, on an Intel MBP. And this does not only happen on every new build, but every time I press "Play", even if no changes have been made. So annoying.

We have no Headers built phase and I did the opposite of @ivayale's solution and disabled the new build system integration (which previously was enabled):

defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 0

As always in Xcode, try toggling all toggles etc.; there seems to be neither sense nor reason behind the actual value. What matter is you change it :)

I tried all solutions and nothing helped to build the Unity project a second time. Downloading an older version of XCode fixes the issue.

For me, the problem was in one of the frameworks that I had added to my workspace and not in my primary project.

Specifically, I was using the Split.io framework version 2.13.0. Looking at the Build Phases of the framework, the sequence was

  1. Dependencies
  2. Compile Sources
  3. Link Binary With Libraries
  4. Headers
  5. Copy Bundle Resources

Changing it to have the Headers step earlier, like this, fixed the problem for me.

  1. Dependencies
  2. Headers
  3. Compile Sources
  4. Link Binary With Libraries
  5. Copy Bundle Resources

This problem is also fixed in Split framework version 2.16.2. Updating to this latest release is probably the easiest way to fix the problem.

For me, the fix was to stop searching, stop reading, stop thinking, take a deep breath and remember the universal Xcode fix: Product > Clean Build Folder, stupid!!

(By the way, this happened immediately after I updated from Xcode 14 Beta to Xcode 14 GM. So it looks like a perennial problem with Xcode updates.)

this worked for me. Error: Circular dependency between modules 'FacebookCore' and 'FBSDKCoreKit' Xcode 14 Thanks,

Xcode 13.3 cycle in dependencies between targets
 
 
Q