Gieta Laksmana
  • Blog
  • Profile
  • Projects
    • VR World Arcade
    • Punch For Fun
    • Spectrum
    • Dimension Battle
  • Resume

XCode10 and prebuild script output files xcfilelist

10/14/2018

0 Comments

 
​Found another quirk with XCode 10. Although this time they did mention it on their release notes (I read the release notes after I hit this issue).

Let's say you have a simple project that generates a file on your pre-build phase, and you include that file on the compilation phase.
Picture
Picture
​This setup will work just fine on Xcode 9 with the old build system. However, on the new build system on Xcode 10, when you build the project for the first time you will get an error saying that the file couldn't be found:
Picture
​When you try to check if the file was there, you will be hit with confusion as the file is generated properly. So what's up with that?

According to Xcode 10 release notes, you now have to explicitly add the generated files name in the Output Files field of the phase, otherwise the build system might try to search for the files before they are generated.​ 
Picture
If you have several generated files that are being used by multiple targets and don't want to duplicate your efforts, you can use the new xcfilelist file that is available for XCode 10. Simply list the generated files inside the xcfilelist, and assign the xcfilelist as an Output File Lists of the phase
Picture
Picture
aand voila, the build system should now find your file correctly

Here's the full Xcode 10 release notes:
​
https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes/build_system_release_notes_for_xcode_10

0 Comments

Xcode 8 Swift 3 compiler bug segmentation fault 11

9/21/2016

0 Comments

 
Recently I've had to go through the hellish task of upgrading my Swift 2 projects to Swift 3. tldr, 1000+ errors fixed later, I was left with 1 persistent error. command failed due to signal: Segmentation fault: 11

​I've never seen this compiler error before, and preliminary research suggested that it's a possible bug in the swift compiler itself.

Thankfully it tells me which file did the fault happened:
While type-checking declaration 0x7fc447c12e00 at /Users/gietal/dev/project/source/Extensions/FileManager+Extensions.swift:5:8
​
It doesn't tell me where in the file did it breaks, but at least I had a starting point. Luckily this file of mine is not that huge, so I'm able to brute force isolate each functions in the file and found that the culprit is a very specific function declaration.

This form of function declaration is the one that's causing the segmentation fault:
public extension FileManager {
  public func foo() throws -> URLRelationship {
    return URLRelationship.other
  }
}
I've found that omitting the throws keyword will avoid this error:
public extension FileManager {
  public func foo() -> URLRelationship {
    return URLRelationship.other
  }
}
This is a very weird behaviour, since if I mark the function with the throws keyword and have it return anything else EXCEPT URLRelationship it will compile just fine. This only happens if the function is marked throws and returns a URLRelationship.

I've filed a bug to Apple regarding this, as I've found someone else had had a similar issue like this with Swift 2.2 before:
​http://blog.bellebethcooper.com/xcode-bug.html

Anyway, this has been an annoying one to track. For now I will just have to workaround the issue by omitting the throws keyword and handle error thrown inside the function some other way.

I hope this post can help someone else who ran into the same issue. If this doesn't help, at least I hope this can give you some ideas into where to start isolating your code to find the offending piece of code.
0 Comments

    Archives

    September 2018
    August 2018
    July 2018
    September 2017
    July 2017
    November 2016
    October 2016
    September 2016
    June 2016
    May 2016
    March 2016

    Categories

    All
    Shenanigans
    Software Engineering
    Swift
    Vr
    Xcode

    RSS Feed

Powered by Create your own unique website with customizable templates.