Xcode 13.3 Build Failed because of Cycle in Dependencies between targets libsignal-protocol-swift

4.8k views Asked by At

After updating to Xcode 13.3 facing Build failed issues with libsignal-protocol-swift library.

This is happening while building second time while after cleaning and building for first time it is working fine. Also, Xcode 13.2.1 has no such errors.

Xcode Error as below :

Cycle inside libsignal-protocol-swift iOS; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.

Cycle details:
→ Target 'libsignal-protocol-swift iOS' has link command with output '/Users/ankitkhanna/Library/Developer/Xcode/DerivedData/BlueSecures-brawgzawheasvqbvhxxglfnlvdlw/Build/Products/Debug-iphoneos/SignalProtocol.framework/SignalProtocol'
○ Target 'libsignal-protocol-swift iOS' has compile command for Swift source files
○ Target 'libsignal-protocol-swift iOS' has copy command from '/Users/ankitkhanna/Documents/Project-Files/Desk-Factors-Project-Files/BlueChats-IOS-master/libsignal-protocol-swift-master/libsignal-protocol-swift/SignalProtocol.h' to '/Users/ankitkhanna/Library/Developer/Xcode/DerivedData/BlueSecures-brawgzawheasvqbvhxxglfnlvdlw/Build/Products/Debug-iphoneos/SignalProtocol.framework/Headers/SignalProtocol.h'
3

There are 3 answers

1
Ankit Khanna On BEST ANSWER

After struggling for sometime the solution was actually the same as mentioned in Xcode suggestions.

i.e. to Move the Headers in project Target -> Build Phases on top Compiled sources.

Drag and move Headers above Compile Sources fixed the error. Please see the image for reference.

enter image description here

enter image description here

0
small dev cloud On

The answer that is marked as a solution didn't work for me. I moved the section on the top, tried to reinstall pods and removed TodayExtension, as another person suggested in another thread. Nothing helped. But that project was cloned from Github before update to Sonoma and Xcode 15. So, I deleted the project with Github desktop client, and then cloned in again (but to another folder). After that I had the same error, but when I tried again to move the section in Build Phases at the top of the list - it worked! So, the marked solution actually works, but maybe you have to reclone your project before (if possible).

1
JonyMateos On

I've faced the same issue after updating to Xcode 13.3; however, in my case, I didn't have Headers in Build Phases.

I've followed these steps to solve it:

  1. Precondition: Xcode must be closed.
  2. Delete the DerivedData folder:
rm -rf ~/Library/Developer/Xcode/DerivedData
  1. In the Terminal, type the following command:
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1