Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 3 Installation Error (Carthage & Manual) #116

Closed
skreutzberger opened this issue Sep 12, 2016 · 12 comments
Closed

Swift 3 Installation Error (Carthage & Manual) #116

skreutzberger opened this issue Sep 12, 2016 · 12 comments
Labels

Comments

@skreutzberger
Copy link

skreutzberger commented Sep 12, 2016

I am using the latest master branch from today and try to build the GRDB for OSX which results in a segmentation fault: 11 for Swift 3 (I am using Xcode 8 GM).

I also tried installing via the latest Carthage 0.18 with the command carthage update --no-use-binaries --platform Mac from GRDB master branch and I see the following errors:

GRDB.swift/GRDB/Core/Database.swift:290:9: warning: 'sqlite3_trace' is deprecated
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)

Together with a lot of xcodebuild warnings about playground files that could not be opened in GRDB.xcworkspace.

How can I fix it or can you please just upload here a working built .framework file for macOS with Swift 3?

@groue groue added the bug label Sep 12, 2016
@groue
Copy link
Owner

groue commented Sep 12, 2016

Hello @skreutzberger.

You're right - something is wrong on macOS in the Release configuration:

Command failed due to signal: Segmentation fault: 11
1.  While running pass #410260 SILFunctionTransform "Simplify CFG" on SILFunction "@_TFC4GRDB24FetchedRecordsController12performFetchfT_T_".

@groue
Copy link
Owner

groue commented Sep 12, 2016

OK so everything lies in FetchedRecordsController.swift. Each time it connects to the database, the compiler segfaults. This is unique to this file (another file uses the DatabaseWriter protocol without any trouble).

@skreutzberger
Copy link
Author

How can I fix it?

@groue
Copy link
Owner

groue commented Sep 12, 2016

I have not yet found a solution. Tweaking the source code in order to present things in another way, hoping the compiler will swallow it, has not succeeded yet (and I had the time to try quite a few tweaks already).

If you don't need FetchedRecordsController, move to the manual installation, and uncheck FetchedRecordsController.swift from your local copy.

If you need this class, you'll have to wait for me to find a fix - if any. I hope I won't have to ship a Swift 3 version of GRDB without FetchedRecordsController (it already lacks support for SQLCipher and sqlite custom build). I'll also look for support at http://bugs.swift.org.

Sorry for the inconvenience - I overlooked the Release configuration... If you want to contribute, go check #115 😄

@skreutzberger
Copy link
Author

No worries, I also had some issues porting all my frameworks and apps to Swift 3. Good luck, I am sure you find a solution!

@mtissington
Copy link

This is also a problem for iOS too when I attempt to generate an Archive build - I get the fault.

A regular build is just fine.

@mtissington
Copy link

Are you sure it's when it connects to the database? I have commented out the bodies of all the functions and I still get a fault ...

@groue
Copy link
Owner

groue commented Sep 13, 2016

I can build iOS, macOS, and watchOS frameworks in Release configuration with Carthage as soon as I remove FetchedRecordsController from all targets:

groue/GRDB.swift$ carthage build --no-skip-current # Have Carthage build local shared schemes

Now when looking for the specific lines that make FetchedRecordsController uncompilable, I can have Xcode build GRDB for macOS by commenting out all the databaseWrite.write { ... } blocks. I haven't investigated iOS and watchOS yet.

I'm still on it!

@groue
Copy link
Owner

groue commented Sep 13, 2016

Even with disabled FetchedRecordsController, tests won't run in Release mode as well 😭. This time because of the DatabaseReader protocol: as soon as it is used (dbReader.read { ... }), compiler crashes.

FYI, DatabaseReader and DatabaseWriter are protocols adopted by DatabaseQueue and DatabasePool. They allow FetchedRecordsController and tests to accept both kinds of connection. They're public, so that user code can be connection-agnostic when needed.

@groue
Copy link
Owner

groue commented Sep 13, 2016

@skreutzberger Would you try again installing GRDB with Carthage from the Swift3 branch? It should work now.

The cost is disabled FetchedRecordsController: the issue is now tracked at #117.

groue added a commit that referenced this issue Sep 13, 2016
…lease configuration (fixes #116)"

This reverts commit cfd6f06.
@jlefler
Copy link

jlefler commented Mar 4, 2017

After b77fa8d, I am unable to build GRDB with Carthage from the swift3 branch. I receive the same SILFunctionTransform segmentation fault error as listed above. If I manually specify commit cfd6f06 in my Cartfile, GRDB updates and compiles properly. Swift version as follows:
Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)

Edit: This was an XCode bug, not a GRDB bug. Solved by upgrading. Thanks to @swiftlyfalling.

@swiftlyfalling
Copy link
Collaborator

@jlefler: You are using Xcode 8.0. Several important Swift 3 compiler bugs have been fixed since 8.0. If you upgrade to Xcode 8.2.1, you should not encounter this issue.

(GRDB's requirements list Xcode 8.1+. This particular compiler issue may have been fixed in 8.1.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants