Sourcery: Error in Xcode 10

I’m getting an error running Sourcery since I passed to Xcode 10 and updated Sourcery to 0.14.0:

No config file provided or it does not exist. Using command line arguments.
Scanning sources...
Found 676 types.
Loading templates...
Loaded 5 templates.
Generating code...
error: Error Domain=NSOSStatusErrorDomain Code=-1 "kCFStreamErrorHTTPParseFailure / kCFSocketError / kCFStreamErrorDomainCustom / kCSIdentityUnknownAuthorityErr / qErr / telGenericError / dsNoExtsMacsBug / kMovieLoadStateError / cdevGenErr: Could not parse the request/response. /  / custom to the kind of stream in question  /  / queue element not found during deletion /  / not a SysErr, just a placeholder  /  / General error; gray cdev w/o alert" UserInfo={terminationReason=__ObjC.Process.TerminationReason, error=dyld: Symbol not found: __T0BOWV
  Referenced from: /Users/david/Library/Caches/Sourcery/AutoCodable.swifttemplate/../SourceryRuntime.framework/Versions/A/SourceryRuntime
  Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
 in /Users/david/Library/Caches/Sourcery/AutoCodable.swifttemplate/../SourceryRuntime.framework/Versions/A/SourceryRuntime
}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 22 (3 by maintainers)

Most upvoted comments

I was also experiencing this issue with v0.15.0.

Deleting ~/Library/Caches/Sourcery fixed the problem for me.

@tskulbru try to use sourcery with command line options (without config files .sourcery.yml), and include --disableCache attribute for example:

./bin/Sourcery.app/Contents/MacOS/Sourcery --sources Test.swift --templates Templates/AutoCodable.swifttemplate --output ./Generated --disableCache --verbose

0.15.0 seems to have solved my issue. Thanks!

With sourcery 0.14.0, you need to use swift 4.1.2. So to check if your CLI uses the correct version run /usr/bin/swiftc --version.

If it uses Xcode 9, it should print something like this:

Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0

And you’d be good to go.

However, with Xcode 10, you’d have something like this:

Apple Swift version 4.2 (swiftlang-1000.0.36 clang-1000.10.44)
Target: x86_64-apple-darwin17.7.0

On my mac, I have 2 Xcode installations:

  • Xcode 9 at /Applications/Xcode.app
  • Xcode 10 at /Applications/Xcode-10.app

To be able to run sourcery locally on my mac, I would just run sudo xcode-select --switch /Applications/Xcode.app.

This is not ideal and will not work outside of a local environment but it may do the trick.

Maybe you could also limit the scope of the swift version selection to the sourcery execution using the TOOLCHAINS variable but I have not looked into that much and I am not sure this would even work 🤔