7

Has anyone run into this issue? I was experimenting with porting an existing obj-c app to Swift, and after quite a few successful builds the project will no longer build and immediately gives the error: Unable to run command 'CompileSwift normal' - this target might include its own product. Along with many other 'target might include it's own product errors'.

What I've Tried:

  • Checking Target Dependencies: There is nothing listed as a target dependency in Build Phases.
  • I've tried completely deleting the product folders, and have went through all the files multiple times but with no luck.
  • If I simply replace the Swift files with the old obj-c files it builds fine, no errors at all.
  • Restoring to a snapshot prior to any Swift modifications results in building as normal, but even if I add a brand new Swift boilerplate file and bridging header, then click build, it fails with the same errors.
tjames
  • 73
  • 1
  • 3
  • It certainly sounds like a bug to me. You can file a bug report at [http://bugreport.apple.com](http://bugreport.apple.com/) – user1118321 Jun 06 '14 at 02:38
  • Not sure if you found another answer, but it seems that this results from a bug in the Xcode 6 beta. I removed it from applications and redownloaded it and that seemed to fix my project. However, once I picked the same target it was broken again :( – Joshua Hudson Jun 06 '14 at 20:30
  • I've pretty much resigned to the fact that this is a bug in the xcode beta, hopefully it'll be resolved in the next seed. – tjames Jun 07 '14 at 14:52
  • I had this same issue, and I'm not *exactly* sure what the cause was, but it turned out I had an import referencing a file that no longer existed. I got the actual error to show up by disabling code signing then re-enabling it. – ahruss Jun 10 '14 at 01:14

3 Answers3

11

I had the same issue. I couldn't work out exactly what was causing it, but realised the same code would build find on a different Xcode 6 install on a different machine.

I solved it by deleting my cached builds, etc, in ~/Library/Developer/Xcode, while Xcode is not running. "Clean" alone from within Xcode didn't do it.

You should find that when you re-launch Xcode your app will build fine.

nekno
  • 19,177
  • 5
  • 42
  • 47
alistair
  • 386
  • 3
  • 4
  • 1
    Yup, looks like every once in a while the Swift compile process just goes insane. – matt Jun 13 '14 at 15:47
  • 2
    For those who don't know how to clean out cached crap: http://stackoverflow.com/questions/5714372/how-to-empty-caches-and-clean-all-targets-xcode-4 Or in short, just remove everything in `~/Library/Developer/Xcode/DerivedData` – Ruben Martinez Jr. Jul 17 '14 at 18:02
5

Deleting my app target from "Build Phases -> Copy Bundle Resources" worked for me. (Somehow it was being included for bundling?)

Pup
  • 10,236
  • 6
  • 45
  • 66
0

I could reproduce the problem. In the objc-to-swift bridge header I imported a header of an objc class, which also imports swift-to-objc header. There was a cycle of imports and this could be the reason Xcode complaint.

I think for now it is best to avoid such cyclic importing between swift and objc. You might want to check that out.