115

I am trying to move to the new build system when compiling with Xcode 10. However, it gives the following error:

Cycle details:
→ Target 'project' : LinkStoryboards

Target 'project' has compile command with input '/Users/project/Commons/Components/ScreenshotSharing/ViewController/AppShare.storyboard'

Target 'project' : ValidateEmbeddedBinary /Users/project/Xcode/DerivedData/project-hgqvaddkhmzxfkaycbicisabeakv/Build/Products/Debug-iphoneos/project.app/PlugIns/stickers.appex

Target 'project' has process command with input '/Users/project/Resources/Info.plist'

Target 'project' has compile command with input '/Users/project/Commons/Components/ScreenshotSharing/ViewController/AppShare.storyboard'

Screenshot added

Even after removing the problem file, I get the same for another xib/storyboard. How can I solve this error without reverting to the legacy build system?

1
  • I had similar error and got it fixed by deleting 'derived data' and cleaning project. This worked like a charm to me! Sep 16, 2019 at 9:44

30 Answers 30

57

For anybody having an issue with Xcode 10 build system, follow the following steps to fix it:

  1. In Xcode, go to File->Project/Workspace settings.
  2. Change the build system to Legacy Build system.

It will resolve the build issue with the new Xcode.

If you want to work with the new build system, then you can find the troubleshooting help from this apple Xcode help page.

5
  • 81
    The whole point of the question is to move to the latest build system. Jun 29, 2018 at 6:32
  • 5
    Then you should mention that in question that you don’t want solution with changing the build system. Also, I have mentioned that if you want to work with new build system then you can follow steps given at Xcode support center. Also, provide a valid reason when you downvote. Thanks! @SahilKapoor Jun 29, 2018 at 11:38
  • 2
    Thank you kind stranger. My only interest is getting my build working again to hit a deadline so your answer is exactly what I needed. Oct 16, 2018 at 21:23
  • 10
    This is not an appropriate solution to the problem. The build system should not be changed to Legacy for something this simple. Feb 1, 2019 at 18:44
  • 1
    Do NOT follow these instructions. This is incorrect. There's a hint in the name: "Legacy" - in fact, it's been deprecated and no longer supported going forward. Jun 22, 2022 at 10:08
50

I was having this issue with Cocoapods. The solution was to clean the build folder re-install all pods, and then rebuild the app. The issue resolved itself that way.

4
  • 2
    This worked for me as well. I did a clean and a pod install. Aug 3, 2018 at 12:56
  • In my case, I'd just done a pod install so only had to clean the build folder. This error only came up after I allowed Xcode to update build settings.
    – Stonetip
    Oct 28, 2018 at 19:55
  • had the issue with Alamofire. Did a 'Clean Build Folder' without reinstalling any cocoa pods and worked fine Sep 14, 2020 at 6:11
  • How do you clean the build folder?
    – rsedlr
    Jan 13 at 10:51
46

In fact, you only need to pay attention to Xcode's prompt This usually can be resolved by moving the target's Headers build phase before Compile Sources, and then you can do it.

When I encountered this problem, Xcode prompts me:

:-1: Cycle inside XXXX; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle details:
→ Target 'XXXX': LinkStoryboards
○ Target 'XXXX: Ditto Path/XXXX-Swift.h /Path/XXXX-Swift.h
○ Target 'XXXX has compile command for Swift source files
○ That command depends on command in Target 'XXXX: script phase “Run Script”

I only did one thing and solved the problem perfectly:

Select Target and then select Build Phase to move the Run Script to the front of Compile Sources.

Run, compiled successfully.

The principle is simple, just change the compilation order.

image 1

Xcode 10.2 & Swift 5

2
  • 4
    this works but only once and then in the next build command, the issue comes back.
    – Swati
    Nov 25, 2019 at 5:52
  • Thanks, that works for me. I used R.swift and this step was in "Installation" but i missed it. Aug 11, 2021 at 21:18
33

I fixed my problem by moving the 'Copy Bundle Resources' Build Phase before all my 'Copy Files' & 'Link Binary with Libraries' Build Phases

3
  • +1 but I used a slight variation. I did not need to move anything ahead of "Link Binary with Libraries", which I would not do because a new default project in Xcode is not like that. I just moved "Copy Bundle Resources" ahead of "Copy Helper Tools" (which copies some command-line tools and a helper app to Contents/Helpers of the macOS app product). But since the order of these two should make any difference – they are only copying files – it does not make sense. So I filed a bug: 42927301. My modified solution: Swap around various Copy XXX Build Phases until it works :( Aug 4, 2018 at 7:04
  • 2
    Same for me, I moved my Copy Bundle Resources above the Copy Files phase and presto it works now. I will dupe your bug @JerryKrinock Oct 29, 2018 at 7:58
  • For me, the problem was with Embed Frameworks dependencies, so I moved Embed Frameworks above Copy Bundle Resources, and it helped.
    – Elena
    Nov 2, 2018 at 15:06
25

I was having this issue with Cocoapods and found a temporary workaround:

  1. Install latest version of cocoapods (1.5.3): sudo gem update cocoapods
  2. Delete you derived data: rm -rf ~/Library/Developer/Xcode/DerivedData/*
  3. pod install

Source here and I'm on Xcode 10 beta 4.

EDIT: now on Xcode 10.0 and still relevant.

2
  • it happened to me again last week on Xcode 10.1 (10B61) and it still worked. Make sure to perform a Clean Build Folder (and quitting Xcode might help also) before doing steps 2. and 3..
    – gabuchan
    Dec 10, 2018 at 1:55
  • Worked like a charm!
    – flagman
    Jan 10, 2019 at 3:52
19

Xcode 10's new build system detects dependency cycles in your build and provides diagnostics to help you resolve them. Fixing these dependency cycles improves the reliability of your build, so that the correct products are produced consistently (cycles are a possible cause of needing to delete your derived data). It also improves your incremental build times, as cycles in the build cause something in your build graph to always be out-of-date on each build, making the build re-do work unnecessarily every time you build.

There is documentation on resolving some common types of dependency cycles in Xcode Help: https://help.apple.com/xcode/mac/current/#/dev621201fb0

That said, this cycle diagnostic looks a little odd. It sounds like you were able to resolve it by re-arranging your build phases, but I don't think the diagnostic really explained the problem. If you wouldn't mind, a bug report about improving this diagnostic for this particular case would be very much appreciated. You can file one at https://bugreport.apple.com. Please include all details about your project that you think might be relevant; a sample project that reproduces the issue is ideal, but if you can't attach that, the diagnostic and some idea of the project structure is still helpful.

17

I had a similar issue with a mixed interaction between Swift, Objective-C and CoreData: in my project (written in Swift) I made use of Core Data's autogenerated Swift classes as well.

But at one point I needed an Objective C class with public properties (defined in its header counterpart) referring the the core data entities.

#import "ProjectName-Swift.h" // this is to import the swift entities into ObjC

@interface myObjCClass : NSObject

@property (nonatomic) MyCoreDataClass*myEntity;

@end

As soon as I changed the CoreData model, XCode tried to rebuild the classes and I got hung with the indicated cycle build error.

After an initial moment of despair, as I did not have any compile header phases in my project to change the order of, I found out that solution was quite simple:

In the myObjCClass.h I removed the shared Swift header import statement and changed it with a @class directive:

@class MyCoreDataClass; // tell the compiler I will import the class definition somewhere else

// the rest stays the same
@interface myObjCClass : NSObject

@property (nonatomic) MyCoreDataClass*myEntity;

@end

and I moved the #import "ProjectName-Swift.h" statement into the myObjCClass.m class definition file.

#import "myObjCClass.h"
#import "ProjectName-Swift.h"

@implementation myObjCClass

@end

And it builded no worries.

1
  • Wow, thanks so much. Been struggling all night with this, but when I thoroughly implemented this suggestion, the problem was fixed! Sep 21, 2019 at 23:37
15

I was finally able to resolve this by moving Embed App Extensions script in Build Phases of main Target to last position.

2
  • Got this error in Xcode 10.0 beta 4 (10L213o) – this workaround solved it :-) Jul 18, 2018 at 23:34
  • how to do that ? can you explain it step by step ?, basically, I have a extension for Siri kit in it and can not run application on simulator but it work on the device
    – Sultan Ali
    Jun 11, 2021 at 12:56
10

My solution was simply to Clean Build Folder then re-build.

4
  • Amazing how nobody rated on this solution. Simple but it's gotta be the first thing we should try before going deeper into the issue.
    – Hoon
    Sep 20, 2019 at 14:55
  • Yep, this fixed it for me May 14, 2021 at 1:13
  • This worked for me - I'm currently on Xcode 13 and 'Clean Build Folder' can be found under the main 'Product' menu option. Feb 16, 2022 at 10:03
  • 4
    This is not a solution as it keeps happening. Apr 14, 2022 at 8:41
7

I was facing the same issue: below was the error

Cycle in dependencies between targets 'Pods-MyAppName' and 'RxCocoa'; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources. Cycle path: Pods-MyAppName → RxCocoa → Pods-MyAppName

I solved it using the below steps:

1). Go to target RxCocoa in Pods-MyAppName project

2) Go to build phases

3) Drag the Headers Phase and move it above the Complile Sources build phase.

This fixed my issue. Hope it helps!

7

In the target's Scheme, find the label Build, and ensure that Find Implicit Dependencies is not checked. These steps may work.

4
  • When you say "close", do you mean it should have a color and a check mark? Or that it should be empty, without a check mark?
    – Ky -
    Feb 14, 2019 at 22:36
  • 1
    Hi, @BenLeggiero. "Close" means it should be empty, without a check mark.
    – Nh Xu
    Feb 25, 2019 at 5:44
  • This solved the problem for me, I unchecked this from the Scheme build tab for the main target (Xcode 13.3). Mar 17, 2022 at 23:34
  • Followup: With that unchecked it would not build attached Framework I had included in the project. So then I cleaned the build folder, re-checked it... and the error message was gone. Mar 17, 2022 at 23:43
4

I have the same issue with Cocoapods.

Firstly, remove pods:

rm -rf ios/Pods

then install pods again:

cd ios && pod install && cd ..

Then run your app, it should works now.

3

I've met similar issue when tried to archive my project on Xcode 10. Here's the detail text:

→ Target 'mytarget': CodeSign /path/to/mytarget.app

○ Target 'mytarget': SetGroup staff /path/to/mytarget.app

○ Target 'mytarget': SetMode u+w,go-w,a+rX /path/to/mytarget.app

○ Target 'mytarget': SetGroup staff /path/to/mytarget.app

Fixed it by setting $(USER) in mytarget -> Build Settings -> Deployment -> Install Owner

3

My issue had to do with a cyclical dependency between my swift bridging header and my objective c files.

In my objective c header files I had a #import "...-swift.h" file and then in a couple of my swift files I was including those files with said import and thus causing a cyclical dependency.

This is the StackOverflow that led me to find the solution:

Objective C, Swift Interoperability issue due to circular dependency

How to prevent circular reference when Swift bridging header imports a file that imports Hopscotch-Swift.h itself

EDIT:

I wound up converting the above files to swift and this solved my issue.

3

The best temporary fix I've found (until you resolve the root problem) is to make a simple change to the source code (even something as trivial as adding a new line) then trying again. I find that making even a whitespace change is enough to allow it to build again. However, this is definitely temporary as it will likely happen again after a few tries.

This is better than cleaning the build folder (which I found to also be temporary) since it's much quicker to make a whitespace change and rebuild, than to clean the build folder and rebuild (especially on larger projects).

1
  • It's really terrible, but this does actually work :(
    – Bek
    Nov 13, 2021 at 22:23
2

It seems that you need to change the order of the build phases within your Pods targets. For me, moving Headers above the rest worked. You can automate this in your Podfile:

require 'xcodeproj'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    headers_phase = target.build_phases.find { |p| p.kind_of?(Xcodeproj::Project::Object::PBXHeadersBuildPhase) }
    if headers_phase
      puts "#{target.name}: Moving Headers build phase to top"
      target.build_phases.insert(0, target.build_phases.delete_at(target.build_phases.index(headers_phase)))
    end
  end
end
2

You might be able to fix this here:

File -> Workspace Settings -> Build System: New Build System

Workspace Settings

1

Same issue on Version 10.0 beta 3 (10L201y) and I wanted to have the New Build System.

Problem is had disabled Enable Modules (C and Objective-C)

in Build Settings -> Apple Clang - Language - Modules

After enabling it (set to YES) got rid of the Error.

1

Core_Data

I had the same problem and error but mine happened when I "Created NSManagedObject Subclass" for my entity and I faced this error. So if you think your error is same as mine about Core Data what can probably help you (and helped me ) is to:

  • click on your Entity in you "xcdatamodel" file
  • go to your right bar click on Data Model Inspector
  • change "Module" to "Current Product Module"
  • and finally, change "Codegen" to "Manual/None"
  • clean and build

I think because in other scenarios Xcode creates a file automatically and when we create another one it causes a conflict.

1

Xcode 10.2.1/Unit Test Target. My unit test target is independent of host target to improve building time. Solve it by uncheck Find Implicit Dependencies in Scheme - Build options, As i specify all dependencies in Build Settings - Compile Sources.

1

Xcode: 11.3.1 Target: XCUITest target

  1. Run command to clean build folder : rm -rf ~/Library/Developer/Xcode/DerivedData/*

  2. Change workspace settings: Select Legacy Build System

enter image description here

0

I have tried things from this page but the only thing that has helped me was that I made a copy of the target and updated the name of the copy (removed the copy suffix), and deleted the old one, and did pod install afterwards.

0

I faced this problem after updating Xcode to version 11.4. Downgrading to 11.2.1 fixed it.

1
  • same here. downgrade from XCode 13.3 to 13.2 helped
    – Laufwunder
    Mar 25, 2022 at 9:09
0

Had this problem for a while as well. Added the following block at the end of the podfile (this will also get rid of some warnings):

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.deployment_target = ios_version
    target.build_configurations.each do |config|
      config.build_settings['IOS_DEPLOYMENT_TARGET'] = 'iOS ' + ios_version
    end
  end
end

I also moved use_frameworks! to the root of the Podfile.

0

In my case,

Removed all pods and reinstall resolved the error

Remove Pods directory in ios folder
pod install
0

Only for Expo

  1. expo prebuild --clean
  2. cd ios
  3. pod install
  4. yarn ios
0

if you are developing on React-Native, it was the best way for me.

cd ios && rm -rf Pods && pod install && cd ..

0

cd ios && rm -rf Pods && pod install && cd ..

This worked for me.

-1

In the project pane on the LHS, for your build products, don't select them in the list for Target membership in the RHS pane.

-3

Following two options worked for me: File->Project/Workspace settings.

1, Change the build system to "Legacy Build system" in File->Project Settings

2, Edit Scheme and Select "Parallelize Build" option under Build section.

1
  • 1
    That's not related. Modern build system wouldn't cause this.
    – Raptor
    Aug 9, 2019 at 8:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.