Cycle inside ; building could produce unreliable r

2020-05-13 20:27发布

I am trying to move to the new build system when compiling with Xcode 10. However, it gives 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 same for another xib/storyboard. How can I solve this error without reverting to the legacy build system?

22条回答
唯我独甜
2楼-- · 2020-05-13 21:00

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.

查看更多
叼着烟拽天下
3楼-- · 2020-05-13 21:01

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!

查看更多
贼婆χ
4楼-- · 2020-05-13 21:02

You might be able to fix this here:

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

Workspace Settings

查看更多
相关推荐>>
5楼-- · 2020-05-13 21:04

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.

查看更多
太酷不给撩
6楼-- · 2020-05-13 21:04

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.

查看更多
劫难
7楼-- · 2020-05-13 21:04

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

查看更多
登录 后发表回答